Skip to content

Commit

Permalink
Merge pull request #228 from tuxmaster5000/0001072
Browse files Browse the repository at this point in the history
Fixes #1072: Newer versions of Fedora use stricter code checking
  • Loading branch information
arogge committed Sep 3, 2019
2 parents 8374154 + 0d2cb83 commit df5a1b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions core/CMakeLists.txt
Expand Up @@ -43,6 +43,16 @@ if (${compiler_will_suggest_override})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
endif()

# make format-security issues a compiler-error
CHECK_CXX_COMPILER_FLAG(-Wformat compiler_format_security)
if (${compiler_format_security})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat")
endif()
CHECK_CXX_COMPILER_FLAG(-Werror=format-security compiler_error_format_security)
if (${compiler_error_format_security})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=format-security")
endif()

# warn on sign-conversion
#include(CheckCCompilerFlag)
#CHECK_C_COMPILER_FLAG(-Wsign-conversion c_compiler_will_warn_sign_conversion)
Expand Down
2 changes: 1 addition & 1 deletion core/src/tests/lib_tests.cc
Expand Up @@ -186,7 +186,7 @@ static void do_get_name_from_hello_test(const char* client_string_fmt,
const BareosVersionNumber& version_test)
{
char bashed_client_name[20];
sprintf(bashed_client_name, client_name);
strncpy(bashed_client_name, client_name, 20);
BashSpaces(bashed_client_name);

char output_text[64];
Expand Down

0 comments on commit df5a1b3

Please sign in to comment.