Merge pull request #383 from moshekaplan/patch-1

Updated message for strncat usage
This commit is contained in:
Daniel Marjamäki 2014-08-02 11:10:16 +02:00
commit f2e3700142
1 changed files with 4 additions and 2 deletions

View File

@ -156,8 +156,10 @@ void CheckBufferOverrun::strncatUsageError(const Token *tok)
reportError(tok, Severity::warning, "strncatUsage", reportError(tok, Severity::warning, "strncatUsage",
"Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.\n" "Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.\n"
"strncat appends at max its 3rd parameter's amount of characters. The safe way to use " "At most, strncat appends the 3rd parameter's amount of characters and adds a terminating null byte.\n"
"strncat is to calculate remaining space in the buffer and use it as 3rd parameter."); "The safe way to use strncat is to subtract one from the remaining space in the buffer and use it as 3rd parameter."
"Source: http://www.cplusplus.com/reference/cstring/strncat/\n"
"Source: http://www.opensource.apple.com/source/Libc/Libc-167/gen.subproj/i386.subproj/strncat.c");
} }
void CheckBufferOverrun::outOfBoundsError(const Token *tok, const std::string &what, const bool show_size_info, const MathLib::bigint &supplied_size, const MathLib::bigint &actual_size) void CheckBufferOverrun::outOfBoundsError(const Token *tok, const std::string &what, const bool show_size_info, const MathLib::bigint &supplied_size, const MathLib::bigint &actual_size)