summaryrefslogtreecommitdiff
path: root/external/cppunit
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-02-20 15:04:17 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-02-20 16:09:24 +0000
commitbd8a213c8ceccf66ab296ef0aea0fa4c451047e5 (patch)
tree8e5c438d353c00725bd78a6c61966dfc576b194c /external/cppunit
parent00867a1833899d70581d4e35b0feb4b8fc66e5b7 (diff)
external/cppunit: Use snprintf instead of sprintf
...to avoid > workdir/UnpackedTarball/cppunit/include/cppunit/TestAssert.h:115:8: error: '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. [-Werror,-Wdeprecated-declarations] > sprintf(buffer, "%.*g", precision, x); > ^ > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here > __deprecated_msg("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.") > ^ > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' > #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) > ^ on macOS after the upcoming <https://gerrit.libreoffice.org/c/core/+/147257> "Don't mis-apply GCC < 4.6 workaround for Clang" Change-Id: I213de1d112cb56fba220006842e611c56ccc7331 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147333 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external/cppunit')
-rw-r--r--external/cppunit/UnpackedTarball_cppunit.mk1
-rw-r--r--external/cppunit/sprintf.patch.011
2 files changed, 12 insertions, 0 deletions
diff --git a/external/cppunit/UnpackedTarball_cppunit.mk b/external/cppunit/UnpackedTarball_cppunit.mk
index f6575bb8b969..4275c692e85e 100644
--- a/external/cppunit/UnpackedTarball_cppunit.mk
+++ b/external/cppunit/UnpackedTarball_cppunit.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
external/cppunit/order.patch.0 \
external/cppunit/windows-arm64.patch.1 \
external/cppunit/propagate-exceptions.patch.0 \
+ external/cppunit/sprintf.patch.0 \
))
ifeq ($(DISABLE_DYNLOADING),TRUE)
$(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
diff --git a/external/cppunit/sprintf.patch.0 b/external/cppunit/sprintf.patch.0
new file mode 100644
index 000000000000..daa4881f3384
--- /dev/null
+++ b/external/cppunit/sprintf.patch.0
@@ -0,0 +1,11 @@
+--- include/cppunit/TestAssert.h
++++ include/cppunit/TestAssert.h
+@@ -112,7 +122,7 @@
+ #if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning.
+ sprintf_s(buffer, sizeof(buffer), "%.*g", precision, x);
+ #else
+- sprintf(buffer, "%.*g", precision, x);
++ snprintf(buffer, sizeof(buffer), "%.*g", precision, x);
+ #endif
+ return buffer;
+ }