summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509v3/v3_extku.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-10-28 05:46:57 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-10-28 05:46:57 +0000
commit3f5bbf0bb3138deee82841b0d107ec3f79aeeccb (patch)
tree9c5cba1254a4667b2b880ecd1d9c474031f25912 /lib/libcrypto/x509v3/v3_extku.c
parent69af88ee726e386ea748b3f85177315e359e8992 (diff)
Check the result of sk_*_push() operations for failure.
ok doug@ jsing@
Diffstat (limited to 'lib/libcrypto/x509v3/v3_extku.c')
-rw-r--r--lib/libcrypto/x509v3/v3_extku.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libcrypto/x509v3/v3_extku.c b/lib/libcrypto/x509v3/v3_extku.c
index 0f36a995254..a9f1d6da6e4 100644
--- a/lib/libcrypto/x509v3/v3_extku.c
+++ b/lib/libcrypto/x509v3/v3_extku.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_extku.c,v 1.9 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_extku.c,v 1.10 2014/10/28 05:46:56 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -144,7 +144,13 @@ v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
X509V3_conf_err(val);
return NULL;
}
- sk_ASN1_OBJECT_push(extku, objtmp);
+ if (sk_ASN1_OBJECT_push(extku, objtmp) == 0) {
+ ASN1_OBJECT_free(objtmp);
+ sk_ASN1_OBJECT_pop_free(extku, ASN1_OBJECT_free);
+ X509V3err(X509V3_F_V2I_EXTENDED_KEY_USAGE,
+ ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
}
return extku;
}