while (sk_X509_INFO_num(sk)) {
xi = sk_X509_INFO_shift(sk);
if (xi->x509 != NULL) {
- sk_X509_push(stack, xi->x509);
+ if (!sk_X509_push(stack, xi->x509)) {
+ X509_INFO_free(xi);
+ goto end;
+ }
xi->x509 = NULL;
count++;
}
* names, and then setup to parse the rest of the line as flags. */
prog = argv[0];
while ((argv1 = argv[1]) != NULL && *argv1 != '-') {
- sk_OPENSSL_CSTRING_push(engines, argv1);
+ if (!sk_OPENSSL_CSTRING_push(engines, argv1))
+ goto end;
argc--;
argv++;
}
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
}
- sk_OPENSSL_CSTRING_push(engines, *argv);
+ if (!sk_OPENSSL_CSTRING_push(engines, *argv))
+ goto end;
}
if (sk_OPENSSL_CSTRING_num(engines) == 0) {
for (e = ENGINE_get_first(); e != NULL; e = ENGINE_get_next(e)) {
- sk_OPENSSL_CSTRING_push(engines, ENGINE_get_id(e));
+ if (!sk_OPENSSL_CSTRING_push(engines, ENGINE_get_id(e)))
+ goto end;
}
}
{
STACK_OF(OPENSSL_CSTRING) *names = vdata;
- sk_OPENSSL_CSTRING_push(names, name);
+ /* A failure to push cannot be handled so we ignore the result. */
+ (void)sk_OPENSSL_CSTRING_push(names, name);
}
void print_names(BIO *out, STACK_OF(OPENSSL_CSTRING) *names)
prog, opt_arg());
goto opthelp;
}
- sk_ASN1_OBJECT_push(trust, objtmp);
+ if (!sk_ASN1_OBJECT_push(trust, objtmp))
+ goto end;
trustout = 1;
break;
case OPT_ADDREJECT:
prog, opt_arg());
goto opthelp;
}
- sk_ASN1_OBJECT_push(reject, objtmp);
+ if (!sk_ASN1_OBJECT_push(trust, objtmp))
+ goto end;
trustout = 1;
break;
case OPT_SETALIAS:
{
/* A section is a CONF_VALUE with name == NULL */
if (v->name == NULL)
- sk_OPENSSL_CSTRING_push(names, v->section);
+ /* A failure to push cannot be handled so we ignore the result. */
+ (void)sk_OPENSSL_CSTRING_push(names, v->section);
}
static int section_name_cmp(OPENSSL_CSTRING const *a, OPENSSL_CSTRING const *b)
goto err;
while (oids && *oids) {
if ((nid = OBJ_txt2nid(*oids)) != NID_undef && (o = OBJ_nid2obj(nid)))
- sk_ASN1_OBJECT_push(sk, o);
+ if (!sk_ASN1_OBJECT_push(sk, o))
+ goto err;
oids++;
}
x = X509V3_EXT_i2d(NID_id_pkix_OCSP_acceptableResponses, 0, sk);
if (!certs)
certs = sk_X509_new_null();
- sk_X509_push(certs, x);
+ if (!sk_X509_push(certs, x)) {
+ X509_free(x);
+ continue;
+ }
} else {
X509_free(x);
}
ASN1_GENERALIZEDTIME *revtime, *thisupd, *nextupd;
certs = sk_X509_new_null();
- if (certs == NULL)
+ if (certs == NULL
+ || !sk_X509_push(certs, x509_1)
+ || !sk_X509_push(certs, x509_2))
goto err;
- sk_X509_push(certs, x509_1);
- sk_X509_push(certs, x509_2);
-
OCSP_basic_verify(bs, certs, store, OCSP_PARTIAL_CHAIN);
id = OCSP_cert_to_id(NULL, x509_1, x509_2);
fixture->req_type = OSSL_CMP_PKIBODY_IR;
fixture->expected = OSSL_CMP_PKISTATUS_accepted;
fixture->caPubs = sk_X509_new_null();
- sk_X509_push(fixture->caPubs, server_cert);
- sk_X509_push(fixture->caPubs, server_cert);
+ if (!sk_X509_push(fixture->caPubs, server_cert)
+ || !sk_X509_push(fixture->caPubs, server_cert)) {
+ tear_down(fixture);
+ return 0;
+ }
ossl_cmp_mock_srv_set1_caPubsOut(fixture->srv_ctx, fixture->caPubs);
EXECUTE_TEST(execute_exec_certrequest_ses_test, tear_down);
return result;
return 0;
}
- sk_SCT_push(fixture->sct_list, sct);
+ if (!sk_SCT_push(fixture->sct_list, sct)) {
+ tear_down(fixture);
+ return 0;
+ }
+
fixture->sct_dir = ct_dir;
fixture->sct_text_file = "tls1.sct";
EXECUTE_CT_TEST();
default:
abort();
}
- sk_GENERAL_NAME_push(gens, gen);
+ if (!sk_GENERAL_NAME_push(gens, gen))
+ goto out;
gen = NULL;
}
if (!X509_add1_ext_i2d(crt, NID_subject_alt_name, gens, 0, 0))