diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-03-04 10:06:22 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-03-06 23:14:08 +0100 |
commit | 386dcbf6b9980e7463dd3f9277c5d3852f118014 (patch) | |
tree | 6b8e8cf5efabe8e88b35c907d264096fcb8bb30e | |
parent | cacc53e427a8d6d5bc3ffb3f90ecf4507b4ef6c8 (diff) |
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 <thiago.macieira@intel.com>
-rw-r--r-- | tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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], |