Show that inconclusive message is inconclusive

This commit is contained in:
Daniel Marjamäki 2012-09-07 16:11:15 +02:00
parent e87ebcc602
commit 6b56b4a9d3
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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() {