summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-09-29 16:20:41 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-09-29 16:20:41 +0000
commit4e151d4ef311e01c1acb0c14ca91999d152de39a (patch)
tree079d18f70d034b86b8ef05fa952ba5ba703b3f19
parent32cf37ee6b5e320e209fc15a703bef7edc178bd1 (diff)
Previous fix (1.12) would cause a NULL pointer dereference in the error path
if a NULL stack was passed as argument. Fix this by returning NULL early in that case.
-rw-r--r--lib/libssl/src/crypto/x509/x509_att.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libssl/src/crypto/x509/x509_att.c b/lib/libssl/src/crypto/x509/x509_att.c
index e3acc18ed14..5e5cf4e3843 100644
--- a/lib/libssl/src/crypto/x509/x509_att.c
+++ b/lib/libssl/src/crypto/x509/x509_att.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_att.c,v 1.12 2014/09/26 19:30:38 miod Exp $ */
+/* $OpenBSD: x509_att.c,v 1.13 2014/09/29 16:20:40 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -73,8 +73,7 @@ X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x)
}
int
-X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,
- int lastpos)
+X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, int lastpos)
{
ASN1_OBJECT *obj;
@@ -133,7 +132,7 @@ X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr)
if (x == NULL) {
X509err(X509_F_X509AT_ADD1_ATTR, ERR_R_PASSED_NULL_PARAMETER);
- goto err2;
+ return (NULL);
}
if (*x == NULL) {