summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2015-07-22 15:52:32 +0000
committerjsing <>2015-07-22 15:52:32 +0000
commitf172031c7c6d9ab690706ae078322d7db8f6f19e (patch)
treeb2a3cba74402e45353dfeca379e519bb54246b5d /src
parent34a3a09672251efabb40f9c8a9c07e616379b8c6 (diff)
downloadopenbsd-f172031c7c6d9ab690706ae078322d7db8f6f19e.tar.gz
openbsd-f172031c7c6d9ab690706ae078322d7db8f6f19e.tar.bz2
openbsd-f172031c7c6d9ab690706ae078322d7db8f6f19e.zip
Revert ca.c r1.7 - BN_to_ASN1_INTEGER() only allocates an ASN.1 integer
when it is not passed a reference to one. In this case, it is passed a reference to an ASN.1 integer that is part of the X509 ASN.1 data structure. Freeing this causes bad things to happen, since it is used and then freed later on. Found the hard way by kinichiro inoguchi.
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/ca.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c
index c7b685ad2b..8500abe4ea 100644
--- a/src/usr.bin/openssl/ca.c
+++ b/src/usr.bin/openssl/ca.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ca.c,v 1.7 2015/07/19 05:50:47 doug Exp $ */ 1/* $OpenBSD: ca.c,v 1.8 2015/07/22 15:52:32 jsing 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 *
@@ -1516,7 +1516,6 @@ do_body(X509 ** xret, EVP_PKEY * pkey, X509 * x509, const EVP_MD * dgst,
1516 ASN1_UTCTIME *tm, *tmptm; 1516 ASN1_UTCTIME *tm, *tmptm;
1517 ASN1_STRING *str, *str2; 1517 ASN1_STRING *str, *str2;
1518 ASN1_OBJECT *obj; 1518 ASN1_OBJECT *obj;
1519 ASN1_INTEGER *check_int;
1520 X509 *ret = NULL; 1519 X509 *ret = NULL;
1521 X509_CINF *ci; 1520 X509_CINF *ci;
1522 X509_NAME_ENTRY *ne; 1521 X509_NAME_ENTRY *ne;
@@ -1806,11 +1805,8 @@ again2:
1806 goto err; 1805 goto err;
1807#endif 1806#endif
1808 1807
1809 if ((check_int = BN_to_ASN1_INTEGER(serial, ci->serialNumber)) == NULL) 1808 if (BN_to_ASN1_INTEGER(serial, ci->serialNumber) == NULL)
1810 goto err; 1809 goto err;
1811 M_ASN1_INTEGER_free(check_int);
1812 check_int = NULL;
1813
1814 if (selfsign) { 1810 if (selfsign) {
1815 if (!X509_set_issuer_name(ret, subject)) 1811 if (!X509_set_issuer_name(ret, subject))
1816 goto err; 1812 goto err;