mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
messages: Make sure we always free the answers pointer
Found by ozz-fuzz BUG: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1272 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -969,7 +969,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
|
|||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (session->kbdint->nanswers > 0) {
|
} else if (session->kbdint->answers != NULL) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
for (n = 0; n < session->kbdint->nanswers; n++) {
|
for (n = 0; n < session->kbdint->nanswers; n++) {
|
||||||
@@ -998,7 +998,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
|
|||||||
}
|
}
|
||||||
session->kbdint->nanswers = nanswers;
|
session->kbdint->nanswers = nanswers;
|
||||||
|
|
||||||
session->kbdint->answers = calloc(1, nanswers * sizeof(char *));
|
session->kbdint->answers = calloc(nanswers, sizeof(char *));
|
||||||
if (session->kbdint->answers == NULL) {
|
if (session->kbdint->answers == NULL) {
|
||||||
session->kbdint->nanswers = 0;
|
session->kbdint->nanswers = 0;
|
||||||
ssh_set_error_oom(session);
|
ssh_set_error_oom(session);
|
||||||
|
|||||||
Reference in New Issue
Block a user