/*
- * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
STACK_OF(GENERAL_NAME) *fnm = NULL;
STACK_OF(X509_NAME_ENTRY) *rnm = NULL;
- if (strncmp(cnf->name, "fullname", 9) == 0) {
+ if (cnf->value == NULL) {
+ ERR_raise(ERR_LIB_X509V3, X509V3_R_MISSING_VALUE);
+ goto err;
+ }
+
+ if (HAS_PREFIX(cnf->name, "fullname")) {
fnm = gnames_from_sectname(ctx, cnf->value);
if (!fnm)
goto err;
return -1;
dnsect = X509V3_get_section(ctx, cnf->value);
if (!dnsect) {
+ X509_NAME_free(nm);
ERR_raise(ERR_LIB_X509V3, X509V3_R_SECTION_NOT_FOUND);
return -1;
}
int i;
crld = sk_DIST_POINT_new_reserve(NULL, num);
- if (crld == NULL)
- goto merr;
+ if (crld == NULL) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
+ goto err;
+ }
for (i = 0; i < num; i++) {
DIST_POINT *point;
} else {
if ((gen = v2i_GENERAL_NAME(method, ctx, cnf)) == NULL)
goto err;
- if ((gens = GENERAL_NAMES_new()) == NULL)
- goto merr;
- if (!sk_GENERAL_NAME_push(gens, gen))
- goto merr;
+ if ((gens = GENERAL_NAMES_new()) == NULL) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
+ goto err;
+ }
+ if (!sk_GENERAL_NAME_push(gens, gen)) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
+ goto err;
+ }
gen = NULL;
- if ((point = DIST_POINT_new()) == NULL)
- goto merr;
+ if ((point = DIST_POINT_new()) == NULL) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
+ goto err;
+ }
sk_DIST_POINT_push(crld, point); /* no failure as it was reserved */
- if ((point->distpoint = DIST_POINT_NAME_new()) == NULL)
- goto merr;
+ if ((point->distpoint = DIST_POINT_NAME_new()) == NULL) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
+ goto err;
+ }
point->distpoint->name.fullname = gens;
point->distpoint->type = 0;
gens = NULL;
}
return crld;
- merr:
- ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
err:
GENERAL_NAME_free(gen);
GENERAL_NAMES_free(gens);
char *name, *val;
int i, ret;
idp = ISSUING_DIST_POINT_new();
- if (idp == NULL)
- goto merr;
+ if (idp == NULL) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
+ goto err;
+ }
for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
cnf = sk_CONF_VALUE_value(nval, i);
name = cnf->name;
}
return idp;
- merr:
- ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
err:
ISSUING_DIST_POINT_free(idp);
return NULL;