diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2012-10-08 21:37:42 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2012-10-12 08:07:02 +0200 |
commit | 0a4ea19982900db1a7942c956c8c2f3ba80aedae (patch) | |
tree | 7eba4e7032e401c40a99da0b036c57ce21b0e269 /src | |
parent | 0bf2dd81e6ed6bcba06b6c03eb18dd6226167088 (diff) | |
download | libssh-0a4ea19982900db1a7942c956c8c2f3ba80aedae.tar.gz libssh-0a4ea19982900db1a7942c956c8c2f3ba80aedae.tar.xz libssh-0a4ea19982900db1a7942c956c8c2f3ba80aedae.zip |
pki: Fix a possible null pointer dereference.
Found by Coverity.
Diffstat (limited to 'src')
-rw-r--r-- | src/pki.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1356,9 +1356,7 @@ ssh_string ssh_pki_do_sign_agent(ssh_session session, ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session, const ssh_key privkey) { - struct ssh_crypto_struct *crypto = - session->current_crypto ? session->current_crypto : - session->next_crypto; + struct ssh_crypto_struct *crypto; unsigned char hash[SHA_DIGEST_LEN] = {0}; ssh_signature sig; ssh_string sig_blob; @@ -1368,6 +1366,8 @@ ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session, if (session == NULL || privkey == NULL || !ssh_key_is_private(privkey)) { return NULL; } + crypto = session->current_crypto ? session->current_crypto : + session->next_crypto; ctx = sha1_init(); if (ctx == NULL) { |