refactoring: changed the severity for strncatUsage from possibleError to style
This commit is contained in:
parent
883d462553
commit
0415560912
|
@ -136,10 +136,10 @@ void CheckBufferOverrun::dangerousStdCin(const Token *tok)
|
|||
|
||||
void CheckBufferOverrun::strncatUsage(const Token *tok)
|
||||
{
|
||||
if (_settings && _settings->inconclusive == false)
|
||||
if (_settings && !_settings->_checkCodingStyle)
|
||||
return;
|
||||
|
||||
reportError(tok, Severity::possibleError, "strncatUsage", "Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append");
|
||||
reportError(tok, Severity::style, "strncatUsage", "Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append");
|
||||
}
|
||||
|
||||
void CheckBufferOverrun::outOfBounds(const Token *tok, const std::string &what)
|
||||
|
|
|
@ -1631,7 +1631,7 @@ private:
|
|||
" strncpy(str, a, 10);\n"
|
||||
" strncat(str, b, 10);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:5]: (possible error) Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:5]: (style) Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append\n", errout.str());
|
||||
}
|
||||
|
||||
void strncat2()
|
||||
|
@ -1641,7 +1641,7 @@ private:
|
|||
" char str[5];\n"
|
||||
" strncat(str, a, 5);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (possible error) Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append\n", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue