summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2018-11-09 04:20:27 +0000
committertb <tb@openbsd.org>2018-11-09 04:20:27 +0000
commitb80f50fac372f2882a6b9da6fb5eafd7b606125e (patch)
tree7e38450b897db4ea778cd179b92a5c7835ccf9e5 /lib
parentFix a buffer overrun in asn1_parse2(). (diff)
downloadwireguard-openbsd-b80f50fac372f2882a6b9da6fb5eafd7b606125e.tar.xz
wireguard-openbsd-b80f50fac372f2882a6b9da6fb5eafd7b606125e.zip
Avoid leaking memory that was already allocated in ASN1_item_new().
From Ben L <bobsayshilol () live ! co ! uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/asn1/evp_asn1.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libcrypto/asn1/evp_asn1.c b/lib/libcrypto/asn1/evp_asn1.c
index 4d616e2b340..4b7ebbb0224 100644
--- a/lib/libcrypto/asn1/evp_asn1.c
+++ b/lib/libcrypto/asn1/evp_asn1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evp_asn1.c,v 1.22 2018/11/09 03:42:30 tb Exp $ */
+/* $OpenBSD: evp_asn1.c,v 1.23 2018/11/09 04:20:27 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -137,12 +137,8 @@ ASN1_TYPE_set_int_octetstring(ASN1_TYPE *at, long num, const unsigned char *data
if ((ios = (ASN1_int_octetstring *)ASN1_item_new(
&ASN1_INT_OCTETSTRING_it)) == NULL)
goto err;
- if ((ios->num = ASN1_INTEGER_new()) == NULL)
- goto err;
if (!ASN1_INTEGER_set(ios->num, num))
goto err;
- if ((ios->value = ASN1_OCTET_STRING_new()) == NULL)
- goto err;
if (!ASN1_OCTET_STRING_set(ios->value, data, len))
goto err;