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.
This commit is contained in:
Werner Koch 2013-08-19 20:38:36 +02:00
parent d788c35e19
commit eae9c32bd9

View File

@ -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);