Restore v2i_AUTHORITY_INFO_ACCESS() behavior

Fixes #13636

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13683)
This commit is contained in:
jwalch 2020-12-15 15:00:11 -05:00 committed by Tomas Mraz
parent 3a1ee3c199
commit 7a7ed5fc79

View File

@ -108,7 +108,7 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
ACCESS_DESCRIPTION *acc;
int i;
const int num = sk_CONF_VALUE_num(nval);
char *ptmp;
char *objtmp, *ptmp;
if ((ainfo = sk_ACCESS_DESCRIPTION_new_reserve(NULL, num)) == NULL) {
ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
@ -130,12 +130,18 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
ctmp.value = cnf->value;
if (!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0))
goto err;
acc->method = OBJ_txt2obj(cnf->value, 0);
if (!acc->method) {
ERR_raise_data(ERR_LIB_X509V3, X509V3_R_BAD_OBJECT,
"value=%s", cnf->value);
if ((objtmp = OPENSSL_strndup(cnf->name, ptmp - cnf->name)) == NULL) {
ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
goto err;
}
acc->method = OBJ_txt2obj(objtmp, 0);
if (!acc->method) {
ERR_raise_data(ERR_LIB_X509V3, X509V3_R_BAD_OBJECT,
"value=%s", objtmp);
OPENSSL_free(objtmp);
goto err;
}
OPENSSL_free(objtmp);
}
return ainfo;
err: