Token: Fixed bug in match function, simplified CheckBufferOverrun code
This commit is contained in:
parent
48dd250796
commit
a669d020cf
|
@ -112,12 +112,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_CheckScope( const TOKEN *tok, c
|
||||||
|
|
||||||
|
|
||||||
// memset, memcmp, memcpy, strncpy, fgets..
|
// memset, memcmp, memcpy, strncpy, fgets..
|
||||||
if (TOKEN::Match(tok,"memset") ||
|
if (TOKEN::Match(tok,"memset|memcpy|memmove|memcmp|strncpy|fgets") )
|
||||||
TOKEN::Match(tok,"memcpy") ||
|
|
||||||
TOKEN::Match(tok,"memmove") ||
|
|
||||||
TOKEN::Match(tok,"memcmp") ||
|
|
||||||
TOKEN::Match(tok,"strncpy") ||
|
|
||||||
TOKEN::Match(tok,"fgets") )
|
|
||||||
{
|
{
|
||||||
if ( TOKEN::Match( tok->next, "( %var1% , %num% , %num% )", varname ) ||
|
if ( TOKEN::Match( tok->next, "( %var1% , %num% , %num% )", varname ) ||
|
||||||
TOKEN::Match( tok->next, "( %var% , %var1% , %num% )", varname ) )
|
TOKEN::Match( tok->next, "( %var% , %var1% , %num% )", varname ) )
|
||||||
|
|
|
@ -219,7 +219,7 @@ bool TOKEN::Match(const TOKEN *tok, const char pattern[], const char *varname1[]
|
||||||
// Empty alternative matches, use the same token on next round
|
// Empty alternative matches, use the same token on next round
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( res == 2 )
|
else if( res == -1 )
|
||||||
{
|
{
|
||||||
// No match
|
// No match
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue