From ba6b5eddcf5bc93ca6f0475e76e157e3bdda6b64 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 31 Jul 2019 19:42:51 -0700 Subject: limit the number of responses from keyboard interactive prompt This makes it safer to accidentally return more than the requested number of responses from the prompt callback. Refs: https://github.com/alexcrichton/ssh2-rs/issues/65 --- src/session.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/session.rs b/src/session.rs index 30be94d..ab27a4f 100644 --- a/src/session.rs +++ b/src/session.rs @@ -347,6 +347,7 @@ impl Session { for (i, response) in (*prompter) .prompt(&username, &instruction, &prompts) .into_iter() + .take(prompts.len()) .enumerate() { let ptr = strdup_string(&response); -- cgit v1.2.3