aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-04-14 10:17:44 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-04-14 10:18:37 +0200
commite56aaf5f44c281715db77fc8fa59c967edd6d4f5 (patch)
tree387bec45167435f878132c5fd39dd1be4bbd6a9c
parent632cee44264c07cefbc4d15e96cf61a1b290395c (diff)
downloadlibssh-e56aaf5f44c281715db77fc8fa59c967edd6d4f5.tar.gz
libssh-e56aaf5f44c281715db77fc8fa59c967edd6d4f5.tar.xz
libssh-e56aaf5f44c281715db77fc8fa59c967edd6d4f5.zip
wrapper: Fixed a possible NULL pointer dereference.
(cherry picked from commit 94e7d345a7561a3ee5923808c2ee65244e2f5184)
-rw-r--r--src/wrapper.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wrapper.c b/src/wrapper.c
index d4ad09cf..6b88e0d2 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -219,11 +219,15 @@ int crypt_set_algorithms_server(ssh_session session){
int i = 0;
struct crypto_struct *ssh_ciphertab=ssh_get_ciphertab();
+ if (session == NULL) {
+ return SSH_ERROR;
+ }
+
/* we must scan the kex entries to find crypto algorithms and set their appropriate structure */
enter_function();
/* out */
server = session->server_kex.methods[SSH_CRYPT_S_C];
- if(session && session->client_kex.methods) {
+ if(session->client_kex.methods) {
client = session->client_kex.methods[SSH_CRYPT_S_C];
} else {
ssh_log(session,SSH_LOG_PROTOCOL, "Client KEX empty");