libgcrypt: Do not leak memory with invalid key lengths
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
dd54ffb2f1
Коммит
7e692ee1b6
@ -359,6 +359,10 @@ static int aes_set_key(struct ssh_cipher_struct *cipher, void *key, void *IV) {
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SSH_LOG(SSH_LOG_WARNING, "Unksupported key length %u.", cipher->keysize);
|
||||
SAFE_FREE(cipher->key);
|
||||
return -1;
|
||||
}
|
||||
if (gcry_cipher_setkey(cipher->key[0], key, cipher->keysize / 8)) {
|
||||
gcry_cipher_close(cipher->key[0]);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user