From c6452adc88160f0a298e380092f3564d48ae9c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 4 Dec 2020 18:58:10 +0100 Subject: [PATCH] Fixed Cppcheck warning; Remove unused private method CheckBufferOverrun::bufferNotZeroTerminatedError --- lib/checkbufferoverrun.cpp | 11 ----------- lib/checkbufferoverrun.h | 1 - 2 files changed, 12 deletions(-) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 21f69612e..2c216540f 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -726,17 +726,6 @@ void CheckBufferOverrun::terminateStrncpyError(const Token *tok, const std::stri "assumes buffer is null-terminated.", CWE170, true); } -void CheckBufferOverrun::bufferNotZeroTerminatedError(const Token *tok, const std::string &varname, const std::string &function) -{ - const std::string errmsg = "$symbol:" + varname + '\n' + - "$symbol:" + function + '\n' + - "The buffer '" + varname + "' is not null-terminated after the call to " + function + "().\n" - "The buffer '" + varname + "' is not null-terminated after the call to " + function + "(). " - "This will cause bugs later in the code if the code assumes the buffer is null-terminated."; - - reportError(tok, Severity::warning, "bufferNotZeroTerminated", errmsg, CWE170, true); -} - //--------------------------------------------------------------------------- diff --git a/lib/checkbufferoverrun.h b/lib/checkbufferoverrun.h index 5b342594d..662225673 100644 --- a/lib/checkbufferoverrun.h +++ b/lib/checkbufferoverrun.h @@ -111,7 +111,6 @@ private: void stringNotZeroTerminated(); void terminateStrncpyError(const Token *tok, const std::string &varname); - void bufferNotZeroTerminatedError(const Token *tok, const std::string &varname, const std::string &function); void objectIndex(); void objectIndexError(const Token *tok, const ValueFlow::Value *v, bool known);