| 404 | } |
| 405 | |
| 406 | void CheckStringImpl::overlappingStrcmpError(const Token *eq0, const Token *ne0) |
| 407 | { |
| 408 | std::string eq0Expr(eq0 ? eq0->expressionString() : std::string("strcmp(x,\"abc\")")); |
| 409 | if (eq0 && eq0->astParent()->str() == "!") |
| 410 | eq0Expr = "!" + eq0Expr; |
| 411 | else |
| 412 | eq0Expr += " == 0"; |
| 413 | |
| 414 | const std::string ne0Expr = (ne0 ? ne0->expressionString() : std::string("strcmp(x,\"def\")")) + " != 0"; |
| 415 | |
| 416 | reportError(ne0, Severity::warning, "overlappingStrcmp", "The expression '" + ne0Expr + "' is suspicious. It overlaps '" + eq0Expr + "'."); |
| 417 | } |
| 418 | |
| 419 | //--------------------------------------------------------------------------- |
| 420 | // Overlapping source and destination passed to sprintf(). |
no test coverage detected