From 6b56b4a9d34fa4bda5c5cc9545add6eedd727d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 7 Sep 2012 16:11:15 +0200 Subject: [PATCH] Show that inconclusive message is inconclusive --- lib/checkbufferoverrun.cpp | 2 +- test/testbufferoverrun.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 071376898..dd844d4ea 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -159,7 +159,7 @@ void CheckBufferOverrun::terminateStrncpyError(const Token *tok, const std::stri "The buffer '" + varname + "' may not be null-terminated after the call to strncpy().\n" "If the source string's size fits or exceeds the given size, strncpy() does not add a " "zero at the end of the buffer. This causes bugs later in the code if the code " - "assumes buffer is null-terminated."); + "assumes buffer is null-terminated.", true); } void CheckBufferOverrun::cmdLineArgsError(const Token *tok) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 6b65d950d..20531dcdc 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -3375,7 +3375,7 @@ private: " strncpy(baz, bar, sizeof(baz));\n" " bar[99] = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (warning) The buffer 'baz' may not be null-terminated after the call to strncpy().\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (warning, inconclusive) The buffer 'baz' may not be null-terminated after the call to strncpy().\n", errout.str()); // Test with invalid code that there is no segfault check("char baz[100];\n" @@ -3390,7 +3390,7 @@ private: " foo(baz);\n" " foo(baz);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (warning) The buffer 'baz' may not be null-terminated after the call to strncpy().\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (warning, inconclusive) The buffer 'baz' may not be null-terminated after the call to strncpy().\n", errout.str()); } void terminateStrncpy2() { @@ -3401,7 +3401,7 @@ private: " bar[99] = 0;\n" " return baz;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (warning) The buffer 'baz' may not be null-terminated after the call to strncpy().\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (warning, inconclusive) The buffer 'baz' may not be null-terminated after the call to strncpy().\n", errout.str()); } void terminateStrncpy3() { @@ -3416,7 +3416,7 @@ private: "void bar(char *p) {\n" " strncpy(p, str, 100);\n" "}\n", false); - ASSERT_EQUALS("[test.cpp:4]: (warning) The buffer 'str' may not be null-terminated after the call to strncpy().\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (warning, inconclusive) The buffer 'str' may not be null-terminated after the call to strncpy().\n", errout.str()); } void recursive_long_time() {