diff options
author | tb <> | 2019-04-22 17:21:01 +0000 |
---|---|---|
committer | tb <> | 2019-04-22 17:21:01 +0000 |
commit | 130e1be827e364dd8e7850c456155b98c77c1915 (patch) | |
tree | ffe5f505c897098b89bdb55b25142f001b5e6735 /src | |
parent | 4c449633b2bc47af1ff9a4e6d2468ab43560947c (diff) | |
download | openbsd-130e1be827e364dd8e7850c456155b98c77c1915.tar.gz openbsd-130e1be827e364dd8e7850c456155b98c77c1915.tar.bz2 openbsd-130e1be827e364dd8e7850c456155b98c77c1915.zip |
Add error checking to i2v_BASIC_CONSTRAINTS().
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509v3/v3_bcons.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_bcons.c b/src/lib/libcrypto/x509v3/v3_bcons.c index 6c5823c44e..9cf5793232 100644 --- a/src/lib/libcrypto/x509v3/v3_bcons.c +++ b/src/lib/libcrypto/x509v3/v3_bcons.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: v3_bcons.c,v 1.15 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: v3_bcons.c,v 1.16 2019/04/22 17:21:01 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -145,9 +145,24 @@ static STACK_OF(CONF_VALUE) * | |||
145 | i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method, BASIC_CONSTRAINTS *bcons, | 145 | i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method, BASIC_CONSTRAINTS *bcons, |
146 | STACK_OF(CONF_VALUE) *extlist) | 146 | STACK_OF(CONF_VALUE) *extlist) |
147 | { | 147 | { |
148 | X509V3_add_value_bool("CA", bcons->ca, &extlist); | 148 | STACK_OF(CONF_VALUE) *free_extlist; |
149 | X509V3_add_value_int("pathlen", bcons->pathlen, &extlist); | 149 | |
150 | if (extlist == NULL) { | ||
151 | if ((free_extlist = extlist = sk_CONF_VALUE_new_null()) == NULL) | ||
152 | return NULL; | ||
153 | } | ||
154 | |||
155 | if (!X509V3_add_value_bool("CA", bcons->ca, &extlist)) | ||
156 | goto err; | ||
157 | if (!X509V3_add_value_int("pathlen", bcons->pathlen, &extlist)) | ||
158 | goto err; | ||
159 | |||
150 | return extlist; | 160 | return extlist; |
161 | |||
162 | err: | ||
163 | sk_CONF_VALUE_pop_free(free_extlist, X509V3_conf_free); | ||
164 | |||
165 | return NULL; | ||
151 | } | 166 | } |
152 | 167 | ||
153 | static BASIC_CONSTRAINTS * | 168 | static BASIC_CONSTRAINTS * |