aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-11-17 12:08:23 +0000
committerWerner Koch <[email protected]>2014-11-17 12:08:23 +0000
commit32e85668b82f6fbcb824eea9548970804fb41d9e (patch)
tree7624f2325143e11fee02e5120b7058d2e5bd1529
parentspeedo: Install -dev files for the libraries. (diff)
downloadgnupg-32e85668b82f6fbcb824eea9548970804fb41d9e.tar.gz
gnupg-32e85668b82f6fbcb824eea9548970804fb41d9e.zip
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r--g10/mainproc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c
index b84607a7b..d908d5795 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -551,6 +551,7 @@ proc_encrypted (CTX c, PACKET *pkt)
int algo;
STRING2KEY s2kbuf;
STRING2KEY *s2k = NULL;
+ int canceled;
if (opt.override_session_key)
{
@@ -591,12 +592,16 @@ proc_encrypted (CTX c, PACKET *pkt)
log_info (_("assuming %s encrypted data\n"), "IDEA");
}
- c->dek = passphrase_to_dek ( NULL, 0, algo, s2k, 3, NULL, NULL );
+ c->dek = passphrase_to_dek ( NULL, 0, algo, s2k, 3, NULL, &canceled);
if (c->dek)
c->dek->algo_info_printed = 1;
+ else if (canceled)
+ result = gpg_error (GPG_ERR_CANCELED);
+ else
+ result = gpg_error (GPG_ERR_INV_PASSPHRASE);
}
}
- else if( !c->dek )
+ else if (!c->dek)
result = G10ERR_NO_SECKEY;
if (!result)
@@ -615,7 +620,7 @@ proc_encrypted (CTX c, PACKET *pkt)
else if (!opt.no_mdc_warn)
log_info (_("WARNING: message was not integrity protected\n"));
}
- else if (result == G10ERR_BAD_SIGN)
+ else if (gpg_err_code (result) == G10ERR_BAD_SIGN)
{
glo_ctrl.lasterr = result;
log_error (_("WARNING: encrypted message has been manipulated!\n"));