Fix seg fault in ASN1_generate_v3/ASN1_generate_nconf

(Imported from upstream's ac5a110621ca48f0bebd5b4d76d081de403da29e)

Change-Id: I1a0518447716a93038bd95d40abef1d9fb4e5f72
Reviewed-on: https://boringssl-review.googlesource.com/4004
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-03-18 19:44:50 -04:00 committed by Adam Langley
parent 2ddba8cd48
commit 87b2a13a86

View File

@ -373,6 +373,11 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
break; break;
case ASN1_GEN_FLAG_FORMAT: case ASN1_GEN_FLAG_FORMAT:
if (!vstart)
{
OPENSSL_PUT_ERROR(ASN1, asn1_cb, ASN1_R_UNKNOWN_FORMAT);
return -1;
}
if (!strncmp(vstart, "ASCII", 5)) if (!strncmp(vstart, "ASCII", 5))
arg->format = ASN1_GEN_FORMAT_ASCII; arg->format = ASN1_GEN_FORMAT_ASCII;
else if (!strncmp(vstart, "UTF8", 4)) else if (!strncmp(vstart, "UTF8", 4))