Skip to content

Commit e9a4f7d

Browse files
Merge pull request wolfSSL#8226 from ColtonWilley/x509_store_fix_get_objects
Fix wolfSSL_X509_STORE_get0_objects to handle no CA
2 parents 5e13fc2 + 5460ba8 commit e9a4f7d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/x509_str.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,13 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects(
18501850
#if defined(WOLFSSL_SIGNER_DER_CERT) && !defined(NO_FILESYSTEM)
18511851
cert_stack = wolfSSL_CertManagerGetCerts(store->cm);
18521852
store->numAdded = 0;
1853+
if (cert_stack == NULL && wolfSSL_sk_X509_num(store->certs) > 0) {
1854+
cert_stack = wolfSSL_sk_X509_new_null();
1855+
if (cert_stack == NULL) {
1856+
WOLFSSL_MSG("wolfSSL_sk_X509_OBJECT_new error");
1857+
goto err_cleanup;
1858+
}
1859+
}
18531860
for (i = 0; i < wolfSSL_sk_X509_num(store->certs); i++) {
18541861
if (wolfSSL_sk_X509_push(cert_stack,
18551862
wolfSSL_sk_X509_value(store->certs, i)) > 0) {

0 commit comments

Comments
 (0)