diff options
| author | tb <> | 2018-04-06 09:19:36 +0000 |
|---|---|---|
| committer | tb <> | 2018-04-06 09:19:36 +0000 |
| commit | 9960bddd07f53a7bf1a404e8165dabde4e956976 (patch) | |
| tree | db6bfe698067be60c96a2232a887dd9eb8f3a43d | |
| parent | b2542bcbfef60a071e39a3b558c224fabb7c3ae6 (diff) | |
| download | openbsd-9960bddd07f53a7bf1a404e8165dabde4e956976.tar.gz openbsd-9960bddd07f53a7bf1a404e8165dabde4e956976.tar.bz2 openbsd-9960bddd07f53a7bf1a404e8165dabde4e956976.zip | |
Avoid leaking str if EVP_Digest() fails.
Found and fixed by Bernd Edlinger as part of OpenSSL commit
83b4049ab75e9da1815e9c854a9297bca3d4af6b
ok jsing, deraadt, bcook
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_digest.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/a_digest.c b/src/lib/libcrypto/asn1/a_digest.c index 085a57d811..5b95adf115 100644 --- a/src/lib/libcrypto/asn1/a_digest.c +++ b/src/lib/libcrypto/asn1/a_digest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_digest.c,v 1.15 2014/07/11 08:44:47 jsing Exp $ */ | 1 | /* $OpenBSD: a_digest.c,v 1.16 2018/04/06 09:19:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -77,8 +77,11 @@ ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, | |||
| 77 | if (!str) | 77 | if (!str) |
| 78 | return (0); | 78 | return (0); |
| 79 | 79 | ||
| 80 | if (!EVP_Digest(str, i, md, len, type, NULL)) | 80 | if (!EVP_Digest(str, i, md, len, type, NULL)) { |
| 81 | return 0; | 81 | free(str); |
| 82 | return (0); | ||
| 83 | } | ||
| 84 | |||
| 82 | free(str); | 85 | free(str); |
| 83 | return (1); | 86 | return (1); |
| 84 | } | 87 | } |
