mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
kex: free server host key before allocating it (again)
Fixes a memory leak when Synology server requests key exchange Closes #43
This commit is contained in:
@@ -202,6 +202,10 @@ static int diffie_hellman_sha1(LIBSSH2_SESSION *session,
|
||||
|
||||
session->server_hostkey_len = _libssh2_ntohu32(exchange_state->s);
|
||||
exchange_state->s += 4;
|
||||
|
||||
if (session->server_hostkey)
|
||||
LIBSSH2_FREE(session, session->server_hostkey);
|
||||
|
||||
session->server_hostkey =
|
||||
LIBSSH2_ALLOC(session, session->server_hostkey_len);
|
||||
if (!session->server_hostkey) {
|
||||
|
||||
Reference in New Issue
Block a user