| 1732 | } |
| 1733 | |
| 1734 | void CheckIOImpl::wrongPrintfScanfArgumentsError(const Token* tok, |
| 1735 | const std::string &functionName, |
| 1736 | nonneg int numFormat, |
| 1737 | nonneg int numFunction) |
| 1738 | { |
| 1739 | const Severity severity = numFormat > numFunction ? Severity::error : Severity::warning; |
| 1740 | if (severity != Severity::error && !mSettings.severity.isEnabled(Severity::warning) && !mSettings.isPremiumEnabled("wrongPrintfScanfArgNum")) |
| 1741 | return; |
| 1742 | |
| 1743 | std::ostringstream errmsg; |
| 1744 | errmsg << functionName |
| 1745 | << " format string requires " |
| 1746 | << numFormat |
| 1747 | << " parameter" << (numFormat != 1 ? "s" : "") << " but " |
| 1748 | << (numFormat > numFunction ? "only " : "") |
| 1749 | << numFunction |
| 1750 | << (numFunction != 1 ? " are" : " is") |
| 1751 | << " given."; |
| 1752 | |
| 1753 | reportError(tok, severity, "wrongPrintfScanfArgNum", errmsg.str(), CWE685, Certainty::normal); |
| 1754 | } |
| 1755 | |
| 1756 | void CheckIOImpl::wrongPrintfScanfPosixParameterPositionError(const Token* tok, const std::string& functionName, |
| 1757 | nonneg int index, nonneg int numFunction) |
no test coverage detected