mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
gssapi: free session->gssapi->user before assigning
To prevent memory leaks with multiple authentication attempts. Signed-off-by: Pavol Žáčik <pzacik@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -2520,6 +2520,7 @@ int ssh_userauth_gssapi_keyex(ssh_session session)
|
||||
session->auth.state = SSH_AUTH_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_AUTH_GSSAPI_KEYEX;
|
||||
|
||||
SAFE_FREE(session->gssapi->user);
|
||||
session->gssapi->user = strdup(session->opts.username);
|
||||
if (session->gssapi->user == NULL) {
|
||||
ssh_set_error_oom(session);
|
||||
|
||||
@@ -1177,6 +1177,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request)
|
||||
received_mic.length = ssh_string_len(mic_token_string);
|
||||
received_mic.value = ssh_string_data(mic_token_string);
|
||||
|
||||
SAFE_FREE(session->gssapi->user);
|
||||
session->gssapi->user = strdup(msg->auth_request.username);
|
||||
buf = ssh_gssapi_build_mic(session, "gssapi-keyex");
|
||||
if (buf == NULL) {
|
||||
|
||||
Reference in New Issue
Block a user