1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

packet: Do not deref a NULL pointer in ssh_packet_set_newkeys()

Fixes T183

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2019-10-22 11:52:28 +02:00
parent e60fc79542
commit e00ef9635a

View File

@@ -1884,6 +1884,10 @@ ssh_packet_set_newkeys(ssh_session session,
direction & SSH_DIRECTION_IN ? " IN " : "",
direction & SSH_DIRECTION_OUT ? " OUT " : "");
if (session->next_crypto == NULL) {
return SSH_ERROR;
}
session->next_crypto->used |= direction;
if (session->current_crypto != NULL) {
if (session->current_crypto->used & direction) {
@@ -1949,6 +1953,11 @@ ssh_packet_set_newkeys(ssh_session session,
return SSH_ERROR;
}
if (session->next_crypto->in_cipher == NULL ||
session->next_crypto->out_cipher == NULL) {
return SSH_ERROR;
}
/* Initialize rekeying states */
ssh_init_rekey_state(session,
session->next_crypto->out_cipher);