Moved CheckString::sprintfOverlappingData from runSimplifiedChecks to runChecks
This commit is contained in:
parent
4218698fb1
commit
f1146e398a
|
@ -428,10 +428,19 @@ void CheckString::sprintfOverlappingData()
|
|||
|
||||
const int formatString = Token::simpleMatch(tok, "sprintf") ? 1 : 2;
|
||||
for (unsigned int argnr = formatString + 1; argnr < args.size(); ++argnr) {
|
||||
const Token *dest = args[0];
|
||||
if (dest->isCast())
|
||||
dest = dest->astOperand2() ? dest->astOperand2() : dest->astOperand1();
|
||||
const Token *arg = args[argnr];
|
||||
if (!arg->valueType() || arg->valueType()->pointer != 1)
|
||||
continue;
|
||||
if (arg->isCast())
|
||||
arg = arg->astOperand2() ? arg->astOperand2() : arg->astOperand1();
|
||||
|
||||
const bool same = isSameExpression(mTokenizer->isCPP(),
|
||||
false,
|
||||
args[0],
|
||||
args[argnr],
|
||||
dest,
|
||||
arg,
|
||||
mSettings->library,
|
||||
true,
|
||||
false);
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
checkString.stringLiteralWrite();
|
||||
checkString.overlappingStrcmp();
|
||||
checkString.checkIncorrectStringCompare();
|
||||
checkString.sprintfOverlappingData();
|
||||
}
|
||||
|
||||
/** @brief Run checks against the simplified token list */
|
||||
|
@ -67,7 +68,6 @@ public:
|
|||
|
||||
// Checks
|
||||
checkString.checkAlwaysTrueOrFalseStringCompare();
|
||||
checkString.sprintfOverlappingData();
|
||||
}
|
||||
|
||||
/** @brief undefined behaviour, writing string literal */
|
||||
|
|
Loading…
Reference in New Issue