Merge branch 'master' of git://github.com/danmar/cppcheck

This commit is contained in:
vBm 2010-12-13 18:20:31 +01:00
commit 0b1006a56a
2 changed files with 11 additions and 2 deletions

View File

@ -114,7 +114,7 @@ void CheckBufferOverrun::bufferOverrun(const Token *tok, const std::string &varn
void CheckBufferOverrun::strncatUsage(const Token *tok)
{
if (!_settings->_checkCodingStyle)
if (_settings && !_settings->_checkCodingStyle)
return;
reportError(tok, Severity::warning, "strncatUsage", "Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append");
@ -127,7 +127,7 @@ void CheckBufferOverrun::outOfBounds(const Token *tok, const std::string &what)
void CheckBufferOverrun::sizeArgumentAsChar(const Token *tok)
{
if (!_settings->_checkCodingStyle)
if (_settings && !_settings->_checkCodingStyle)
return;
reportError(tok, Severity::warning, "sizeArgumentAsChar", "The size argument is given as a char constant");
}

View File

@ -188,6 +188,8 @@ private:
TEST_CASE(cmdLineArgs1);
TEST_CASE(scope); // handling different scopes
TEST_CASE(getErrorMessages);
}
@ -2699,6 +2701,13 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
}
void getErrorMessages()
{
// Ticket #2292: segmentation fault when using --errorlist
CheckBufferOverrun c;
c.getErrorMessages();
}
};
REGISTER_TEST(TestBufferOverrun)