| 809 | } |
| 810 | |
| 811 | void CheckBufferOverrunImpl::terminateStrncpyError(const Token *tok, const std::string &varname) |
| 812 | { |
| 813 | const std::string shortMessage = "The buffer '$symbol' may not be null-terminated after the call to strncpy()."; |
| 814 | reportError(tok, Severity::warning, "terminateStrncpy", |
| 815 | "$symbol:" + varname + '\n' + |
| 816 | shortMessage + '\n' + |
| 817 | shortMessage + ' ' + |
| 818 | "If the source string's size fits or exceeds the given size, strncpy() does not add a " |
| 819 | "zero at the end of the buffer. This causes bugs later in the code if the code " |
| 820 | "assumes buffer is null-terminated.", CWE170, Certainty::inconclusive); |
| 821 | } |
| 822 | //--------------------------------------------------------------------------- |
| 823 | |
| 824 | void CheckBufferOverrunImpl::argumentSize() |
no test coverage detected