curl-curl/tests/server
Viktor Szakats 64f28b8f88
curlx: add local snprintf() helper that always nul-terminates (Windows)
Make the helper use `vsnprintf()` internally on all supported Windows
toolchains (dropping `_snprintf()` and `snprintf()`), ensure to
nul-terminate. Omit the return value to avoid complexity.

Use the helper from `mprintf.c` / `out_double()`, from tests/server code
and the tests/server-specific build of `curlx_inet_ntop()`,
`curlx_strerror()` functions. In the single call (in tests) where the
returned length was used previously, determine it with `strlen()`.

Refs:
https://github.com/libssh2/libssh2/blob/libssh2-1.11.1/src/misc.c#L57-L79
https://learn.microsoft.com/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l
https://learn.microsoft.com/cpp/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l

Assisted-by: Jay Satiro
Follow-up to fa8bd1cc09 #20761
Follow-up to 8ab468c8aa #15997

Closes #20765
2026-03-02 21:30:36 +01:00
..
.checksrc build: tidy up and dedupe strdup functions 2026-02-03 14:02:30 +01:00
.gitignore tests: always make bundles, adapt build and tests 2025-06-14 21:08:23 +02:00
CMakeLists.txt cmake: rename testbins target to tt, restore internal option 2026-03-01 00:24:47 +01:00
dnsd.c tests/server: fix to clear the complete srvr_sockaddr_union_t variable 2026-02-26 04:19:18 +01:00
first.c build: use more const 2026-02-02 12:32:49 +01:00
first.h curlx: add local snprintf() helper that always nul-terminates (Windows) 2026-03-02 21:30:36 +01:00
getpart.c build: use more const 2026-02-02 12:32:49 +01:00
Makefile.am localtime: detect thread-safe alternatives and use them 2025-12-16 14:30:06 +01:00
Makefile.inc curlx: add local snprintf() helper that always nul-terminates (Windows) 2026-03-02 21:30:36 +01:00
mqttd.c clang-tidy: avoid/silence bugprone-not-null-terminated-result 2026-02-25 22:11:05 +01:00
resolve.c build: use more const 2026-02-02 12:32:49 +01:00
rtspd.c tests/server: fix to clear the complete srvr_sockaddr_union_t variable 2026-02-26 04:19:18 +01:00
sockfilt.c tests/server/sockfilt: check for NULL tv to silence clang-tidy 2026-02-20 12:08:52 +01:00
socksd.c tidy-up: miscellaneous 2026-02-25 14:44:56 +01:00
sws.c tests/server: fix to clear the complete srvr_sockaddr_union_t variable 2026-02-26 04:19:18 +01:00
tftpd.c curlx: add local snprintf() helper that always nul-terminates (Windows) 2026-03-02 21:30:36 +01:00
util.c tests/server: fix to clear the complete srvr_sockaddr_union_t variable 2026-02-26 04:19:18 +01:00