1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpg: Fix a NULL-deref for invalid input data.

* g10/mainproc.c (proc_encrypted): Take care of canceled passpharse
entry.
--

GnuPG-bug-id: 1761
Signed-off-by: Werner Koch <wk@gnupg.org>

(backported from commit 32e85668b82f6fbcb824eea9548970804fb41d9e)
This commit is contained in:
Werner Koch 2014-11-24 19:32:47 +01:00
parent fbb50867f8
commit 69767ccf42

View File

@ -540,7 +540,9 @@ proc_encrypted( CTX c, PACKET *pkt )
result = -1;
else if( !c->dek && !c->last_was_session_key ) {
int algo;
STRING2KEY s2kbuf, *s2k = NULL;
STRING2KEY s2kbuf;
STRING2KEY *s2k = NULL;
int canceled;
if(opt.override_session_key)
{
@ -580,9 +582,13 @@ proc_encrypted( CTX c, PACKET *pkt )
log_info (_("assuming %s encrypted data\n"), "IDEA");
}
c->dek = passphrase_to_dek ( NULL, 0, algo, s2k, 0, NULL, NULL );
c->dek = passphrase_to_dek ( NULL, 0, algo, s2k, 0, NULL,&canceled);
if (c->dek)
c->dek->algo_info_printed = 1;
else if (canceled)
result = G10ERR_CANCELED;
else
result = G10ERR_PASSPHRASE;
}
}
else if( !c->dek )