This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git

commit 6488cfe6557161ef36187ddc98a8de5f2a531da1
Author: Pavel Vazharov <[email protected]>
AuthorDate: Thu May 16 18:21:52 2024 +0300

    Remove the need of `-Wno-stringop-overflow` warning suppression (#11357)
    
    * Remove the need of -Wno-stringop-overflow warning suppression
    
    The problem was that GCC complained for possibly incorrect usage of
    strncat due to the last argument being equal to the source string length.
    The last argument of strncat is supposed to be the remaining free space in
    the destination buffer.
    Replaced the usage of strncat with the ATS function ink_strlcat.
    
    * Fix bogus warning for strncat usage in s3_auth plugin given by GCC 11
    
    The change is to use TSstrlcat instead of strncat.
    It seems to me the GCC analyzer is wrong in this case and it issues the
    warning because of such usage:
    str_concat(&left[loff], (left_size - loff), "/", 1);
    and the str_concat internally does
    std::min(dst_len, src_len) for the strncat size argument.
    So GCC sees the possibility that the last argument of strncat can be
    equal to the legnth of the source argument and issues the warning.
---
 unit_tests/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt
index a26ab69..0a2d4de 100644
--- a/unit_tests/CMakeLists.txt
+++ b/unit_tests/CMakeLists.txt
@@ -33,7 +33,7 @@ add_executable(test_libswoc
 target_link_libraries(test_libswoc PUBLIC libswoc)
 set_target_properties(test_libswoc PROPERTIES CLANG_FORMAT_DIRS 
${CMAKE_CURRENT_SOURCE_DIR})
 if (CMAKE_COMPILER_IS_GNUCXX)
-    target_compile_options(test_libswoc PRIVATE -Wall -Wextra -Werror 
-Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow 
-Wno-invalid-offsetof)
+    target_compile_options(test_libswoc PRIVATE -Wall -Wextra -Werror 
-Wno-unused-parameter -Wno-format-truncation -Wno-invalid-offsetof)
     # stop the compiler from complaining about unused variable in structured 
binding
     if (GCC_VERSION VERSION_LESS 8.0)
         target_compile_options(test_libswoc PRIVATE -Wno-unused-variable)

Reply via email to