From a92e782fa3fc48807cc1e36bbbe59f8169c71225 Mon Sep 17 00:00:00 2001 From: doug <> Date: Wed, 25 Feb 2015 04:56:41 +0000 Subject: Avoid NULL pointer deref in hashinfo_free() when calling from error paths. Also, nuke debugging printfs per jsing and bcook. ok bcook@, jsing@ --- src/usr.bin/openssl/certhash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c index 992ef31cd5..f274cda8fd 100644 --- a/src/usr.bin/openssl/certhash.c +++ b/src/usr.bin/openssl/certhash.c @@ -91,6 +91,9 @@ hashinfo(const char *filename, unsigned long hash, unsigned char *fingerprint) static void hashinfo_free(struct hashinfo *hi) { + if (hi == NULL) + return; + free(hi->filename); free(hi->target); free(hi); @@ -359,10 +362,8 @@ certhash_addlink(struct hashinfo **links, struct hashinfo *hi) if ((link = hashinfo(NULL, hi->hash, hi->fingerprint)) == NULL) goto err; -printf("hi->is_crl = %i\n", hi->is_crl); if ((link->filename = hashinfo_linkname(hi)) == NULL) goto err; -printf("filename = %s\n", link->filename); link->reference = hi; link->changed = 1; -- cgit v1.2.3-55-g6feb