clang deprecates sprintf on macos

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)
This commit is contained in:
Nikola Pajkovsky
2025-10-15 12:48:06 +02:00
committed by Neil Horman
parent c20d4704e9
commit 60e699a454
2 changed files with 4 additions and 4 deletions

View 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();

View 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);