]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
clang deprecates sprintf on macos
authorNikola Pajkovsky <nikolap@openssl.org>
Wed, 15 Oct 2025 10:48:06 +0000 (12:48 +0200)
committerNeil Horman <nhorman@openssl.org>
Tue, 21 Oct 2025 11:58:53 +0000 (07:58 -0400)
test/threadstest.c:1376:9: error: 'sprintf' is deprecated.

The same issues is in the ossl-nghttp3-demo.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28903)

(cherry picked from commit 60e699a4549779f72b8621415b7565d422127285)

demos/http3/ossl-nghttp3-demo-server.c
test/threadstest.c

index 2b44fb8b14211234bdb53ec514018d45cdbb25c0..52ac77f0a77520074ad129d9322f181b99bf6f25 100644 (file)
@@ -1166,17 +1166,17 @@ static int run_quic_server(SSL_CTX *ctx, int fd)
             /* We don't find the file: use default test string */
             h3ssl.ptr_data = nulldata;
             h3ssl.ldata = nulldata_sz;
-            sprintf(slength, "%zu", h3ssl.ldata);
+            snprintf(slength, sizeof(slength), "%zu", h3ssl.ldata);
             /* content-type: text/html */
             make_nv(&resp[num_nv++], "content-type", "text/html");
         } else if (h3ssl.ldata == INT_MAX) {
             /* endless file for tests */
-            sprintf(slength, "%zu", h3ssl.ldata);
+            snprintf(slength, sizeof(slength), "%zu", h3ssl.ldata);
             h3ssl.ptr_data = (uint8_t *) malloc(4096);
             memset(h3ssl.ptr_data, 'A', 4096);
         } else {
             /* normal file we have opened */
-            sprintf(slength, "%zu", h3ssl.ldata);
+            snprintf(slength, sizeof(slength), "%zu", h3ssl.ldata);
             h3ssl.ptr_data = (uint8_t *) get_file_data(&h3ssl);
             if (h3ssl.ptr_data == NULL)
                 abort();
index e85bb8c8eec72024d5d357ed8d9a59444919d9e9..685e8b47bfb190ffa1e58eead8c020d4775c3ded 100644 (file)
@@ -1373,7 +1373,7 @@ static void test_obj_create_worker(void)
 
     for (i = 0; i < 4; i++) {
         now = time(NULL);
-        sprintf(name, "Time in Seconds = %ld", (long) now);
+        snprintf(name, sizeof(name), "Time in Seconds = %ld", (long) now);
         while (now == time(NULL))
             /* no-op */;
         nid = OBJ_create(NULL, NULL, name);