kex.c: fix possible NULL pointer de-reference with session->kex

Fixes VS2012 code analysis warning C6011:
dereferencing NULL pointer 'session->kex'. libssh2 kex.c 1761
This commit is contained in:
Marc Hoersken 2014-12-15 00:17:10 +01:00
parent abcc0d370f
commit 1c1699545b

View File

@ -1756,7 +1756,7 @@ _libssh2_kex_exchange(LIBSSH2_SESSION * session, int reexchange,
key_state->state = libssh2_NB_state_sent2;
}
if (rc == 0) {
if (rc == 0 && session->kex) {
if (key_state->state == libssh2_NB_state_sent2) {
retcode = session->kex->exchange_keys(session,
&key_state->key_state_low);