external/cppunit/UnpackedTarball_cppunit.mk |    1 +
 external/cppunit/sprintf.patch.0            |   11 +++++++++++
 2 files changed, 12 insertions(+)

New commits:
commit bd8a213c8ceccf66ab296ef0aea0fa4c451047e5
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Feb 20 15:04:17 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Feb 20 16:09:24 2023 +0000

    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 <sberg...@redhat.com>

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

Reply via email to