1
1

pki: Fix a possible null pointer dereference.

Found by Coverity.
Этот коммит содержится в:
Andreas Schneider 2012-10-08 21:37:42 +02:00
родитель 0bf2dd81e6
Коммит 0a4ea19982

Просмотреть файл

@ -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, ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session,
const ssh_key privkey) const ssh_key privkey)
{ {
struct ssh_crypto_struct *crypto = struct ssh_crypto_struct *crypto;
session->current_crypto ? session->current_crypto :
session->next_crypto;
unsigned char hash[SHA_DIGEST_LEN] = {0}; unsigned char hash[SHA_DIGEST_LEN] = {0};
ssh_signature sig; ssh_signature sig;
ssh_string sig_blob; 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)) { if (session == NULL || privkey == NULL || !ssh_key_is_private(privkey)) {
return NULL; return NULL;
} }
crypto = session->current_crypto ? session->current_crypto :
session->next_crypto;
ctx = sha1_init(); ctx = sha1_init();
if (ctx == NULL) { if (ctx == NULL) {