diff options
| author | miod <> | 2014-09-29 16:20:40 +0000 |
|---|---|---|
| committer | miod <> | 2014-09-29 16:20:40 +0000 |
| commit | 2fec0ddac457c1eb5a9eba935bc918591b7a26df (patch) | |
| tree | 1190fa256a10b7a7b484dff877f6a89f0665e351 /src | |
| parent | fce1b32e886bf430459364bfd3edd882b13a1303 (diff) | |
| download | openbsd-2fec0ddac457c1eb5a9eba935bc918591b7a26df.tar.gz openbsd-2fec0ddac457c1eb5a9eba935bc918591b7a26df.tar.bz2 openbsd-2fec0ddac457c1eb5a9eba935bc918591b7a26df.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_att.c | 7 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/x509/x509_att.c | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/libcrypto/x509/x509_att.c b/src/lib/libcrypto/x509/x509_att.c index e3acc18ed1..5e5cf4e384 100644 --- a/src/lib/libcrypto/x509/x509_att.c +++ b/src/lib/libcrypto/x509/x509_att.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_att.c,v 1.12 2014/09/26 19:30:38 miod Exp $ */ | 1 | /* $OpenBSD: x509_att.c,v 1.13 2014/09/29 16:20:40 miod 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 | * |
| @@ -73,8 +73,7 @@ X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x) | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | int | 75 | int |
| 76 | X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, | 76 | X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, int lastpos) |
| 77 | int lastpos) | ||
| 78 | { | 77 | { |
| 79 | ASN1_OBJECT *obj; | 78 | ASN1_OBJECT *obj; |
| 80 | 79 | ||
| @@ -133,7 +132,7 @@ X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr) | |||
| 133 | 132 | ||
| 134 | if (x == NULL) { | 133 | if (x == NULL) { |
| 135 | X509err(X509_F_X509AT_ADD1_ATTR, ERR_R_PASSED_NULL_PARAMETER); | 134 | X509err(X509_F_X509AT_ADD1_ATTR, ERR_R_PASSED_NULL_PARAMETER); |
| 136 | goto err2; | 135 | return (NULL); |
| 137 | } | 136 | } |
| 138 | 137 | ||
| 139 | if (*x == NULL) { | 138 | if (*x == NULL) { |
diff --git a/src/lib/libssl/src/crypto/x509/x509_att.c b/src/lib/libssl/src/crypto/x509/x509_att.c index e3acc18ed1..5e5cf4e384 100644 --- a/src/lib/libssl/src/crypto/x509/x509_att.c +++ b/src/lib/libssl/src/crypto/x509/x509_att.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_att.c,v 1.12 2014/09/26 19:30:38 miod Exp $ */ | 1 | /* $OpenBSD: x509_att.c,v 1.13 2014/09/29 16:20:40 miod 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 | * |
| @@ -73,8 +73,7 @@ X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x) | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | int | 75 | int |
| 76 | X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, | 76 | X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, int lastpos) |
| 77 | int lastpos) | ||
| 78 | { | 77 | { |
| 79 | ASN1_OBJECT *obj; | 78 | ASN1_OBJECT *obj; |
| 80 | 79 | ||
| @@ -133,7 +132,7 @@ X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr) | |||
| 133 | 132 | ||
| 134 | if (x == NULL) { | 133 | if (x == NULL) { |
| 135 | X509err(X509_F_X509AT_ADD1_ATTR, ERR_R_PASSED_NULL_PARAMETER); | 134 | X509err(X509_F_X509AT_ADD1_ATTR, ERR_R_PASSED_NULL_PARAMETER); |
| 136 | goto err2; | 135 | return (NULL); |
| 137 | } | 136 | } |
| 138 | 137 | ||
| 139 | if (*x == NULL) { | 138 | if (*x == NULL) { |
