mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-17 04:22:32 +03:00
Prevent possible double free of hostkey (#1452)
NULL server hostkey based on fuzzer failure case.
This commit is contained in:
@@ -469,8 +469,11 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session,
|
||||
buf.dataptr = buf.data;
|
||||
buf.dataptr++; /* advance past type */
|
||||
|
||||
if(session->server_hostkey)
|
||||
if(session->server_hostkey) {
|
||||
LIBSSH2_FREE(session, session->server_hostkey);
|
||||
session->server_hostkey = NULL;
|
||||
session->server_hostkey_len = 0;
|
||||
}
|
||||
|
||||
if(_libssh2_copy_string(session, &buf, &(session->server_hostkey),
|
||||
&host_key_len)) {
|
||||
|
||||
Reference in New Issue
Block a user