CheckBufferOverrun: loop through all arguments in checkFunctionCall
This commit is contained in:
parent
b43c2de63a
commit
a24cbc448a
|
@ -475,22 +475,18 @@ void CheckBufferOverrun::checkFunctionCall(const Token *tok, const ArrayInfo &ar
|
||||||
|
|
||||||
const unsigned int declarationId = arrayInfo.declarationId();
|
const unsigned int declarationId = arrayInfo.declarationId();
|
||||||
|
|
||||||
const Token *tok2 = tok->tokAt(2);
|
const Token *argtok = tok->tokAt(2);
|
||||||
// 1st parameter..
|
unsigned int argnr = 1U;
|
||||||
if (Token::Match(tok2, "%varid% ,|)", declarationId))
|
while (argtok) {
|
||||||
checkFunctionParameter(*tok, 1, arrayInfo, callstack);
|
if (Token::Match(argtok, "%varid% ,|)", declarationId))
|
||||||
else if (Token::Match(tok2, "%varid% + %num% ,|)", declarationId)) {
|
checkFunctionParameter(*tok, argnr, arrayInfo, callstack);
|
||||||
const ArrayInfo ai(arrayInfo.limit(MathLib::toLongNumber(tok2->strAt(2))));
|
else if (Token::Match(argtok, "%varid% + %num% ,|)", declarationId)) {
|
||||||
checkFunctionParameter(*tok, 1, ai, callstack);
|
const ArrayInfo ai(arrayInfo.limit(MathLib::toLongNumber(argtok->strAt(2))));
|
||||||
}
|
checkFunctionParameter(*tok, argnr, ai, callstack);
|
||||||
|
}
|
||||||
// goto 2nd parameter and check it..
|
// goto next parameter..
|
||||||
tok2 = tok2->nextArgument();
|
argtok = argtok->nextArgument();
|
||||||
if (Token::Match(tok2, "%varid% ,|)", declarationId))
|
argnr++;
|
||||||
checkFunctionParameter(*tok, 2, arrayInfo, callstack);
|
|
||||||
else if (Token::Match(tok2, "%varid% + %num% ,|)", declarationId)) {
|
|
||||||
const ArrayInfo ai(arrayInfo.limit(MathLib::toLongNumber(tok2->strAt(2))));
|
|
||||||
checkFunctionParameter(*tok, 2, ai, callstack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue