Dangerous functions: Improved error messages

This commit is contained in:
Daniel Marjamäki 2010-08-13 22:27:45 +02:00
parent 5e1168fc5c
commit e9a3d03372
1 changed files with 5 additions and 2 deletions

View File

@ -62,10 +62,13 @@ void CheckDangerousFunctions::dangerousFunctionmktemp(const Token *tok)
void CheckDangerousFunctions::dangerousFunctiongets(const Token *tok)
{
reportError(tok, Severity::style, "dangerousFunctiongets", "Found 'gets'. You should use 'fgets' instead");
reportError(tok, Severity::style, "dangerousFunctiongets", "Found 'gets'. You should use 'fgets' instead\n"
"Using gets can easily cause buffer overflows.");
}
void CheckDangerousFunctions::dangerousFunctionscanf(const Token *tok)
{
reportError(tok, Severity::style, "dangerousFunctionscanf", "Found 'scanf'. You should use 'fgets' instead");
reportError(tok, Severity::style, "dangerousFunctionscanf", "Found 'scanf'. You should use 'fgets' instead\n"
"If reading a string the 'scanf' can easily cause a buffer overflow if the data is too big.\n"
"If you want to convert the input to a number a wrong input may cause a crash.");
}