diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-09-29 16:20:41 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-09-29 16:20:41 +0000 |
commit | 3376faeb2a904716233942703403c01257327e69 (patch) | |
tree | 5a69f2fc1f70e33a459af22482224fa3f7cb4801 | |
parent | 9ae27a3075e7b27a58799a9ce5bb230b6b272dbb (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/libcrypto/x509/x509_att.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libcrypto/x509/x509_att.c b/lib/libcrypto/x509/x509_att.c index e3acc18ed14..5e5cf4e3843 100644 --- a/lib/libcrypto/x509/x509_att.c +++ b/lib/libcrypto/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) { |