Buffer overrun: Fixed a false positive

This commit is contained in:
Daniel Marjamäki 2008-11-05 23:49:46 +00:00
parent 8b9e223265
commit c16c12c70a
2 changed files with 3 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/*
/*
* c++check - c/c++ syntax checking
* Copyright (C) 2007 Daniel Marjamäki
*
@ -91,7 +91,7 @@ static void CheckBufferOverrun_CheckScope( const TOKEN *tok, const char *varname
}
// Array index..
if ( !IsName(tok->str) && tok->str[0] != '.' && Match(tok->next, "%var1% [ %num% ]", varname) )
if ( !Match(tok, "%var%") && !Match(tok,"[.&]") && Match(tok->next, "%var1% [ %num% ]", varname) )
{
const char *num = getstr(tok->next, 2 + varc);
if (strtol(num, NULL, 10) >= size)

View File

@ -61,9 +61,7 @@ private:
TEST_CASE( noerr1 );
TEST_CASE( noerr2 );
TEST_CASE( noerr3 );
// Todo: Fix this.
//TEST_CASE( noerr4 );
TEST_CASE( noerr4 );
TEST_CASE( array_index_1 );
TEST_CASE( array_index_2 );