From 386dcbf6b9980e7463dd3f9277c5d3852f118014 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sat, 4 Mar 2023 10:06:22 +0100 Subject: Silence warning about unsafe sprintf, use snprintf instead Apple lets us know that: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. Pick-to: 6.5 Change-Id: I3130b3c7b636466b5e77adc5cb05ad4ce1faee11 Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp index 04d7268f06..50077f601f 100644 --- a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp +++ b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp @@ -70,7 +70,7 @@ namespace QTest { char *toString(const Ip6 &ip6) { char buf[sizeof "1111:2222:3333:4444:5555:6666:7777:8888" + 2]; - sprintf(buf, "%x:%x:%x:%x:%x:%x:%x:%x", + snprintf(buf, sizeof(buf), "%x:%x:%x:%x:%x:%x:%x:%x", ip6.u8[0] << 8 | ip6.u8[1], ip6.u8[2] << 8 | ip6.u8[3], ip6.u8[4] << 8 | ip6.u8[5], -- cgit v1.2.3