aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-08 21:37:42 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-12 08:07:02 +0200
commit0a4ea19982900db1a7942c956c8c2f3ba80aedae (patch)
tree7eba4e7032e401c40a99da0b036c57ce21b0e269
parent0bf2dd81e6ed6bcba06b6c03eb18dd6226167088 (diff)
downloadlibssh-0a4ea19982900db1a7942c956c8c2f3ba80aedae.tar.gz
libssh-0a4ea19982900db1a7942c956c8c2f3ba80aedae.tar.xz
libssh-0a4ea19982900db1a7942c956c8c2f3ba80aedae.zip
pki: Fix a possible null pointer dereference.
Found by Coverity.
-rw-r--r--src/pki.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pki.c b/src/pki.c
index db9b84e8..cba73ce2 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -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) {