office-gobmx/external/cppunit/sprintf.patch.0
Stephan Bergmann bd8a213c8c 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>
2023-02-20 16:09:24 +00:00

11 lines
430 B
Text

--- 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;
}