diff options
author | 2018-04-06 09:19:36 +0000 | |
---|---|---|
committer | 2018-04-06 09:19:36 +0000 | |
commit | 2fd5f4563df9c4d6200a0d2e06881af8c8cd510b (patch) | |
tree | b2328635637f10d897f137e04b066369eac789c9 | |
parent | Fix link, from Eliran Gonen. (diff) | |
download | wireguard-openbsd-2fd5f4563df9c4d6200a0d2e06881af8c8cd510b.tar.xz wireguard-openbsd-2fd5f4563df9c4d6200a0d2e06881af8c8cd510b.zip |
Avoid leaking str if EVP_Digest() fails.
Found and fixed by Bernd Edlinger as part of OpenSSL commit
83b4049ab75e9da1815e9c854a9297bca3d4af6b
ok jsing, deraadt, bcook
-rw-r--r-- | lib/libcrypto/asn1/a_digest.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libcrypto/asn1/a_digest.c b/lib/libcrypto/asn1/a_digest.c index 085a57d8111..5b95adf1155 100644 --- a/lib/libcrypto/asn1/a_digest.c +++ b/lib/libcrypto/asn1/a_digest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_digest.c,v 1.15 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: a_digest.c,v 1.16 2018/04/06 09:19:36 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -77,8 +77,11 @@ ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, if (!str) return (0); - if (!EVP_Digest(str, i, md, len, type, NULL)) - return 0; + if (!EVP_Digest(str, i, md, len, type, NULL)) { + free(str); + return (0); + } + free(str); return (1); } |