Fix dirmngr crash (bug#1300)

This commit is contained in:
Werner Koch 2011-02-23 10:51:36 +01:00
parent 7c03c8cc65
commit 6902560059
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-02-23 Werner Koch <wk@g10code.com>
* certcache.c (get_cert_bysubject): Take care of a NULL argument.
(find_cert_bysubject): Ditto. Fixes bug#1300.
2011-02-09 Werner Koch <wk@g10code.com> 2011-02-09 Werner Koch <wk@g10code.com>
* ks-engine-kdns.c: New but only the framework. * ks-engine-kdns.c: New but only the framework.

View File

@ -652,6 +652,9 @@ get_cert_bysubject (const char *subject_dn, unsigned int seq)
cert_item_t ci; cert_item_t ci;
int i; int i;
if (!subject_dn)
return NULL;
acquire_cache_read_lock (); acquire_cache_read_lock ();
for (i=0; i < 256; i++) for (i=0; i < 256; i++)
{ {
@ -1101,7 +1104,7 @@ find_cert_bysubject (ctrl_t ctrl, const char *subject_dn, ksba_sexp_t keyid)
uniquely located by the following code we can use them. This is uniquely located by the following code we can use them. This is
for example required by Telesec certificates where a keyId is for example required by Telesec certificates where a keyId is
used but the issuer certificate comes without a subject keyId! */ used but the issuer certificate comes without a subject keyId! */
if (ctrl->ocsp_certs) if (ctrl->ocsp_certs && subject_dn)
{ {
cert_item_t ci; cert_item_t ci;
cert_ref_t cr; cert_ref_t cr;