]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Use OPENSSL_strdup instead of strdup
authorAndrew Dinh <andrewd@openssl.org>
Thu, 20 Feb 2025 06:59:07 +0000 (13:59 +0700)
committerTomas Mraz <tomas@openssl.org>
Fri, 21 Feb 2025 10:21:48 +0000 (11:21 +0100)
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643038

Also NULL check for the allocation.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26843)

test/quicapitest.c

index c324f28997a5ce368592ecab9e7bffaffb0e8d42..5b7ba0793146dbddf271d92dad55f890f0d7a6a6 100644 (file)
@@ -600,7 +600,8 @@ static int find_new_token_data(BIO *membio)
                 TEST_info("Next line did not contain a new token\n");
                 state = FAILED;
             } else {
-                tokenval = strdup(tmpstring);
+                if (!TEST_ptr(tokenval = OPENSSL_strdup(tmpstring)))
+                    return 0;
                 state = CHECK_TOKEN;
                 TEST_info("Recorded Token %s\n", tokenval);
             }