Token: Fixed bug in match function, simplified CheckBufferOverrun code

This commit is contained in:
Reijo Tomperi 2008-12-05 20:37:05 +00:00
parent 48dd250796
commit a669d020cf
2 changed files with 2 additions and 7 deletions

View File

@ -112,12 +112,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_CheckScope( const TOKEN *tok, c
// memset, memcmp, memcpy, strncpy, fgets..
if (TOKEN::Match(tok,"memset") ||
TOKEN::Match(tok,"memcpy") ||
TOKEN::Match(tok,"memmove") ||
TOKEN::Match(tok,"memcmp") ||
TOKEN::Match(tok,"strncpy") ||
TOKEN::Match(tok,"fgets") )
if (TOKEN::Match(tok,"memset|memcpy|memmove|memcmp|strncpy|fgets") )
{
if ( TOKEN::Match( tok->next, "( %var1% , %num% , %num% )", varname ) ||
TOKEN::Match( tok->next, "( %var% , %var1% , %num% )", varname ) )

View File

@ -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
continue;
}
else if( res == 2 )
else if( res == -1 )
{
// No match
return false;