summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-02-12 06:04:25 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-02-12 06:04:25 +0000
commitcdeb5f28ac0050b8a9e583e3fd6c88031f893355 (patch)
tree68e4ceecd47348f46f5b5afa3c84759c9dc68c1b /lib/libcrypto
parent3ff372d636801373cc76788414010fd6224bb039 (diff)
prevent a crash with openssl asn1parse -genstr FORMAT
aka ASN1_generate_nconf("FORMAT", NULL) ok krw@ beck@ jsing@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/asn1/asn1_gen.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libcrypto/asn1/asn1_gen.c b/lib/libcrypto/asn1/asn1_gen.c
index 97be43a03a1..384088308f7 100644
--- a/lib/libcrypto/asn1/asn1_gen.c
+++ b/lib/libcrypto/asn1/asn1_gen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asn1_gen.c,v 1.12 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: asn1_gen.c,v 1.13 2015/02/12 06:04:24 jsg Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2002.
*/
@@ -348,6 +348,10 @@ asn1_cb(const char *elem, int len, void *bitstr)
break;
case ASN1_GEN_FLAG_FORMAT:
+ if (vstart == NULL) {
+ ASN1err(ASN1_F_ASN1_CB, ASN1_R_ILLEGAL_FORMAT);
+ return -1;
+ }
if (!strncmp(vstart, "ASCII", 5))
arg->format = ASN1_GEN_FORMAT_ASCII;
else if (!strncmp(vstart, "UTF8", 4))