]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add test for NULL uri handling in OSSL_STORE_delete()
authorWeidong Wang <kenazcharisma@gmail.com>
Tue, 24 Mar 2026 17:10:28 +0000 (12:10 -0500)
committerTomas Mraz <tomas@openssl.foundation>
Thu, 2 Apr 2026 07:14:06 +0000 (09:14 +0200)
Verify that passing NULL as the uri parameter to OSSL_STORE_delete()
returns 0 rather than crashing with a NULL pointer dereference.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Apr  2 07:14:09 2026
(Merged from https://github.com/openssl/openssl/pull/30512)

test/ossl_store_test.c

index f251313d1a699d79588a960994d0ed1a4cbd74d4..104ae3ad610bd29a4652069ce66404c26b7f053b 100644 (file)
@@ -249,6 +249,12 @@ static int test_store_attach_unregistered_scheme(void)
     return ret;
 }
 
+static int test_store_delete_null_uri(void)
+{
+    /* Passing NULL uri must return 0, not crash */
+    return TEST_int_eq(OSSL_STORE_delete(NULL, NULL, NULL, NULL, NULL, NULL), 0);
+}
+
 const OPTIONS *test_get_options(void)
 {
     static const OPTIONS test_options[] = {
@@ -303,6 +309,7 @@ int setup_tests(void)
     ADD_TEST(test_store_open_winstore);
 #endif
     ADD_TEST(test_store_search_by_key_fingerprint_fail);
+    ADD_TEST(test_store_delete_null_uri);
     ADD_ALL_TESTS(test_store_get_params, 3);
     if (sm2file != NULL)
         ADD_TEST(test_store_attach_unregistered_scheme);