diff options
author | doug <> | 2015-02-25 04:56:41 +0000 |
---|---|---|
committer | doug <> | 2015-02-25 04:56:41 +0000 |
commit | a92e782fa3fc48807cc1e36bbbe59f8169c71225 (patch) | |
tree | b6df86b86f5718e00f5fbef7b551ffe902b85bb3 | |
parent | b958a03fbcadc7756562b7767378655598be4933 (diff) | |
download | openbsd-a92e782fa3fc48807cc1e36bbbe59f8169c71225.tar.gz openbsd-a92e782fa3fc48807cc1e36bbbe59f8169c71225.tar.bz2 openbsd-a92e782fa3fc48807cc1e36bbbe59f8169c71225.zip |
Avoid NULL pointer deref in hashinfo_free() when calling from error paths.
Also, nuke debugging printfs per jsing and bcook.
ok bcook@, jsing@
-rw-r--r-- | src/usr.bin/openssl/certhash.c | 5 |
1 files 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) | |||
91 | static void | 91 | static void |
92 | hashinfo_free(struct hashinfo *hi) | 92 | hashinfo_free(struct hashinfo *hi) |
93 | { | 93 | { |
94 | if (hi == NULL) | ||
95 | return; | ||
96 | |||
94 | free(hi->filename); | 97 | free(hi->filename); |
95 | free(hi->target); | 98 | free(hi->target); |
96 | free(hi); | 99 | free(hi); |
@@ -359,10 +362,8 @@ certhash_addlink(struct hashinfo **links, struct hashinfo *hi) | |||
359 | if ((link = hashinfo(NULL, hi->hash, hi->fingerprint)) == NULL) | 362 | if ((link = hashinfo(NULL, hi->hash, hi->fingerprint)) == NULL) |
360 | goto err; | 363 | goto err; |
361 | 364 | ||
362 | printf("hi->is_crl = %i\n", hi->is_crl); | ||
363 | if ((link->filename = hashinfo_linkname(hi)) == NULL) | 365 | if ((link->filename = hashinfo_linkname(hi)) == NULL) |
364 | goto err; | 366 | goto err; |
365 | printf("filename = %s\n", link->filename); | ||
366 | 367 | ||
367 | link->reference = hi; | 368 | link->reference = hi; |
368 | link->changed = 1; | 369 | link->changed = 1; |