From 5eb41492c452081b95eecad374a3ddef73cd384c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 24 Apr 2017 13:27:20 +0200 Subject: [PATCH] messages: Do not leak memory if answeres had been allocated previously Found by ozz-fuzz BUG: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1222 Signed-off-by: Andreas Schneider --- src/messages.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/messages.c b/src/messages.c index 199ec4cd..b953ee6d 100644 --- a/src/messages.c +++ b/src/messages.c @@ -1010,6 +1010,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){ goto error; } + SAFE_FREE(session->kbdint->answers[i]); session->kbdint->answers[i] = ssh_string_to_char(tmp); ssh_string_free(tmp); if (session->kbdint->answers[i] == NULL) {