From e881495eaf53603666ebae756154ea919b1287fa Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Thu, 31 Jul 2014 13:51:29 -0400 Subject: [PATCH] Updated message for strncat usage --- lib/checkbufferoverrun.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 4216a5977..94e8793cd 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -156,8 +156,10 @@ void CheckBufferOverrun::strncatUsageError(const Token *tok) reportError(tok, Severity::warning, "strncatUsage", "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 " - "strncat is to calculate remaining space in the buffer and use it as 3rd parameter."); + "At most, strncat appends the 3rd parameter's amount of characters and adds a terminating null byte.\n" + "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)