[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] NULL ctx pointer in ssh_cipher_clear()
[Thread Prev] | [Thread Next]
- Subject: [PATCH] NULL ctx pointer in ssh_cipher_clear()
- From: Valerio De Benedetto <valerio@xxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Tue, 6 Jun 2017 09:45:36 +0200
- To: libssh@xxxxxxxxxx
If ssh_handle_key_exchange() fails, when ssh_free() is called cipher->ctx is NULL
From 70d711443d47310fa1094943ca3a5046e7a5787b Mon Sep 17 00:00:00 2001
From: debevv <valerio@xxxxxxxxxxxxx>
Date: Tue, 6 Jun 2017 09:28:58 +0200
Subject: [PATCH] If ssh_handle_key_exchange() fails, when ssh_free() is called
cipher->ctx is NULL
Signed-off-by: debevv <valerio@xxxxxxxxxxxxx>
---
src/wrapper.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/wrapper.c b/src/wrapper.c
index af166da..db33446 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -120,11 +120,13 @@ void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
SAFE_FREE(cipher->key);
}
#endif
- if (cipher->cleanup != NULL){
- cipher->cleanup(cipher);
- }
+ if(cipher->ctx) {
+ if (cipher->cleanup != NULL){
+ cipher->cleanup(cipher);
+ }
#ifdef HAVE_LIBCRYPTO
- EVP_CIPHER_CTX_free(cipher->ctx);
+ EVP_CIPHER_CTX_free(cipher->ctx);
+ }
#endif
}
--
2.7.4
Archive administrator: postmaster@lists.cynapses.org