mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
CVE-2020-1730: Fix a possible segfault when zeroing AES-CTR key
Fixes T213 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
@@ -713,8 +713,12 @@ aes_ctr_encrypt(struct ssh_cipher_struct *cipher,
|
||||
}
|
||||
|
||||
static void aes_ctr_cleanup(struct ssh_cipher_struct *cipher){
|
||||
explicit_bzero(cipher->aes_key, sizeof(*cipher->aes_key));
|
||||
SAFE_FREE(cipher->aes_key);
|
||||
if (cipher != NULL) {
|
||||
if (cipher->aes_key != NULL) {
|
||||
explicit_bzero(cipher->aes_key, sizeof(*cipher->aes_key));
|
||||
}
|
||||
SAFE_FREE(cipher->aes_key);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_OPENSSL_EVP_AES_CTR */
|
||||
|
||||
Reference in New Issue
Block a user