checkio: Add missing id "invalidScanfFormatWidth_smaller" to errorlist output (#1533)

This commit is contained in:
Sebastian 2018-12-20 21:14:02 +01:00 committed by amai2012
parent d528934139
commit a1a695dcda
2 changed files with 2 additions and 1 deletions

View File

@ -1982,7 +1982,7 @@ void CheckIO::invalidScanfFormatWidthError(const Token* tok, unsigned int numFor
std::ostringstream errmsg; std::ostringstream errmsg;
if (arrlen > width) { if (arrlen > width) {
if (!mSettings->inconclusive || !mSettings->isEnabled(Settings::WARNING)) if (tok != nullptr && (!mSettings->inconclusive || !mSettings->isEnabled(Settings::WARNING)))
return; return;
errmsg << "Width " << width << " given in format string (no. " << numFormat << ") is smaller than destination buffer" errmsg << "Width " << width << " given in format string (no. " << numFormat << ") is smaller than destination buffer"
<< " '" << varname << "[" << arrlen << "]'."; << " '" << varname << "[" << arrlen << "]'.";

View File

@ -162,6 +162,7 @@ private:
c.invalidPrintfArgTypeError_float(nullptr, 1, "f", nullptr); c.invalidPrintfArgTypeError_float(nullptr, 1, "f", nullptr);
c.invalidLengthModifierError(nullptr, 1, "I"); c.invalidLengthModifierError(nullptr, 1, "I");
c.invalidScanfFormatWidthError(nullptr, 10, 5, nullptr, 's'); c.invalidScanfFormatWidthError(nullptr, 10, 5, nullptr, 's');
c.invalidScanfFormatWidthError(nullptr, 99, -1, nullptr, 's');
c.wrongPrintfScanfPosixParameterPositionError(nullptr, "printf", 2, 1); c.wrongPrintfScanfPosixParameterPositionError(nullptr, "printf", 2, 1);
} }