From: Andrew Dinh Date: Thu, 20 Feb 2025 06:59:07 +0000 (+0700) Subject: Use OPENSSL_strdup instead of strdup X-Git-Tag: openssl-3.5.0-alpha1~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d69f4005b51794255b255d676932107873c346e;p=thirdparty%2Fopenssl.git Use OPENSSL_strdup instead of strdup Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643038 Also NULL check for the allocation. Reviewed-by: Saša Nedvědický Reviewed-by: Tom Cosgrove Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26843) --- diff --git a/test/quicapitest.c b/test/quicapitest.c index c324f28997a..5b7ba079314 100644 --- a/test/quicapitest.c +++ b/test/quicapitest.c @@ -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); }