From a669d020cfd10afb750dc28b1606c950f993eee5 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Fri, 5 Dec 2008 20:37:05 +0000 Subject: [PATCH] Token: Fixed bug in match function, simplified CheckBufferOverrun code --- CheckBufferOverrun.cpp | 7 +------ token.cpp | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/CheckBufferOverrun.cpp b/CheckBufferOverrun.cpp index 5d8d3b88b..f2e39ff3b 100644 --- a/CheckBufferOverrun.cpp +++ b/CheckBufferOverrun.cpp @@ -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 ) ) diff --git a/token.cpp b/token.cpp index 6820ae1e2..916b2f15f 100644 --- a/token.cpp +++ b/token.cpp @@ -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;