mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +03:00
wrapper: Fix possible crash in ssh_handle_key_exchange()
If ssh_handle_key_exchange() fails, when ssh_free() is called cipher->ctx is NULL. Signed-off-by: debevv <valerio@sonicpengu.in>
This commit is contained in:
committed by
Andreas Schneider
parent
5333be5988
commit
48e7b098f8
@@ -120,12 +120,14 @@ void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
|
||||
SAFE_FREE(cipher->key);
|
||||
}
|
||||
#endif
|
||||
if (cipher->cleanup != NULL){
|
||||
if (cipher->ctx != NULL) {
|
||||
if (cipher->cleanup != NULL) {
|
||||
cipher->cleanup(cipher);
|
||||
}
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
EVP_CIPHER_CTX_free(cipher->ctx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void cipher_free(struct ssh_cipher_struct *cipher) {
|
||||
|
||||
Reference in New Issue
Block a user