aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2013-08-19 18:38:36 +0000
committerWerner Koch <[email protected]>2013-08-19 18:38:36 +0000
commiteae9c32bd9c80ca4a4ecf794808211808f2ebbdd (patch)
tree099cdc178da35934c7ddb5fbf8a17f21b175a6c9
parentRelease 1.4.3. (diff)
downloadgpgme-eae9c32bd9c80ca4a4ecf794808211808f2ebbdd.tar.gz
gpgme-eae9c32bd9c80ca4a4ecf794808211808f2ebbdd.zip
tests: Fix NULL ptr deref in gpgsm/t-verify.
* tests/gpgsm/t-verify.c (check_result): Do not dereference a sig or sig->fpr if NULL.
-rw-r--r--tests/gpgsm/t-verify.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c
index a26617e0..901b46fb 100644
--- a/tests/gpgsm/t-verify.c
+++ b/tests/gpgsm/t-verify.c
@@ -63,6 +63,8 @@ check_result (gpgme_verify_result_t result, int summary, char *fpr,
fprintf (stderr, "%s:%i: Unexpected number of signatures\n",
__FILE__, __LINE__);
got_errors = 1;
+ if (!sig)
+ return;
}
if (sig->summary != summary)
{
@@ -71,7 +73,7 @@ check_result (gpgme_verify_result_t result, int summary, char *fpr,
__FILE__, __LINE__, summary, sig->summary);
got_errors = 1;
}
- if (strcmp (sig->fpr, fpr))
+ if (sig->fpr && strcmp (sig->fpr, fpr))
{
fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n",
__FILE__, __LINE__, sig->fpr);