Fix seg fault in ASN1_generate_v3/ASN1_generate_nconf

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
This commit is contained in:
Matt Caswell 2015-03-10 23:15:15 +00:00
parent 97a0cc5281
commit ac5a110621

View file

@ -353,6 +353,10 @@ 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) {
ASN1err(ASN1_F_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))