Fixed #1636 (Fix false positive with strncpy termination check)
This commit is contained in:
parent
b261e5df25
commit
344b6bf434
|
@ -1009,7 +1009,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
|
||||||
if (_settings->_checkCodingStyle)
|
if (_settings->_checkCodingStyle)
|
||||||
{
|
{
|
||||||
// check for strncpy which is not terminated
|
// check for strncpy which is not terminated
|
||||||
if (Token::Match(tok, "strncpy ( %varid% , %any% , %num% )", arrayInfo.varid))
|
if ((Token::Match(tok, "strncpy ( %varid% , %var% , %num% )", arrayInfo.varid)))
|
||||||
{
|
{
|
||||||
// strncpy takes entire variable length as input size
|
// strncpy takes entire variable length as input size
|
||||||
if ((unsigned int)MathLib::toLongNumber(tok->strAt(6)) >= total_size)
|
if ((unsigned int)MathLib::toLongNumber(tok->strAt(6)) >= total_size)
|
||||||
|
|
Loading…
Reference in New Issue