Dangerous functions: Improved error messages
This commit is contained in:
parent
5e1168fc5c
commit
e9a3d03372
|
@ -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.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue