mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 10:27:22 +09:00
server: Check strdup allocation failure
Thanks Xiaoke Wang for the report! Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Pavol Žáčik <pzacik@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -497,6 +497,11 @@ static size_t callback_receive_banner(const void *data, size_t len, void *user)
|
||||
buffer[i] = '\0';
|
||||
|
||||
str = strdup(buffer);
|
||||
if (str == NULL) {
|
||||
session->session_state = SSH_SESSION_STATE_ERROR;
|
||||
ssh_set_error_oom(session);
|
||||
return 0;
|
||||
}
|
||||
/* number of bytes read */
|
||||
processed = i + 1;
|
||||
session->clientbanner = str;
|
||||
|
||||
Reference in New Issue
Block a user