diff options
author | miod <> | 2014-10-28 05:46:56 +0000 |
---|---|---|
committer | miod <> | 2014-10-28 05:46:56 +0000 |
commit | 41c028be1988ad160ef2fa6feca4441bb4bca17d (patch) | |
tree | e5031b50fe250a2c5c8752bd1c08d24591108740 /src/lib/libcrypto/ts | |
parent | 77608e1e83f23ad41247b5fe52616f87439bb30f (diff) | |
download | openbsd-41c028be1988ad160ef2fa6feca4441bb4bca17d.tar.gz openbsd-41c028be1988ad160ef2fa6feca4441bb4bca17d.tar.bz2 openbsd-41c028be1988ad160ef2fa6feca4441bb4bca17d.zip |
Check the result of sk_*_push() operations for failure.
ok doug@ jsing@
Diffstat (limited to 'src/lib/libcrypto/ts')
-rw-r--r-- | src/lib/libcrypto/ts/ts_conf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/libcrypto/ts/ts_conf.c b/src/lib/libcrypto/ts/ts_conf.c index ec033b1cfc..5266f91e63 100644 --- a/src/lib/libcrypto/ts/ts_conf.c +++ b/src/lib/libcrypto/ts/ts_conf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ts_conf.c,v 1.7 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: ts_conf.c,v 1.8 2014/10/28 05:46:56 miod Exp $ */ |
2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
3 | * project 2002. | 3 | * project 2002. |
4 | */ | 4 | */ |
@@ -110,7 +110,8 @@ end: | |||
110 | return x; | 110 | return x; |
111 | } | 111 | } |
112 | 112 | ||
113 | STACK_OF(X509) *TS_CONF_load_certs(const char *file) | 113 | STACK_OF(X509) * |
114 | TS_CONF_load_certs(const char *file) | ||
114 | { | 115 | { |
115 | BIO *certs = NULL; | 116 | BIO *certs = NULL; |
116 | STACK_OF(X509) *othercerts = NULL; | 117 | STACK_OF(X509) *othercerts = NULL; |
@@ -126,7 +127,11 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file) | |||
126 | for (i = 0; i < sk_X509_INFO_num(allcerts); i++) { | 127 | for (i = 0; i < sk_X509_INFO_num(allcerts); i++) { |
127 | X509_INFO *xi = sk_X509_INFO_value(allcerts, i); | 128 | X509_INFO *xi = sk_X509_INFO_value(allcerts, i); |
128 | if (xi->x509) { | 129 | if (xi->x509) { |
129 | sk_X509_push(othercerts, xi->x509); | 130 | if (sk_X509_push(othercerts, xi->x509) == 0) { |
131 | sk_X509_pop_free(othercerts, X509_free); | ||
132 | othercerts = NULL; | ||
133 | goto end; | ||
134 | } | ||
130 | xi->x509 = NULL; | 135 | xi->x509 = NULL; |
131 | } | 136 | } |
132 | } | 137 | } |