Buffer overrun: Fixed a false positive
This commit is contained in:
parent
8b9e223265
commit
c16c12c70a
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* c++check - c/c++ syntax checking
|
* c++check - c/c++ syntax checking
|
||||||
* Copyright (C) 2007 Daniel Marjamäki
|
* Copyright (C) 2007 Daniel Marjamäki
|
||||||
*
|
*
|
||||||
|
@ -91,7 +91,7 @@ static void CheckBufferOverrun_CheckScope( const TOKEN *tok, const char *varname
|
||||||
}
|
}
|
||||||
|
|
||||||
// Array index..
|
// 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);
|
const char *num = getstr(tok->next, 2 + varc);
|
||||||
if (strtol(num, NULL, 10) >= size)
|
if (strtol(num, NULL, 10) >= size)
|
||||||
|
|
|
@ -61,9 +61,7 @@ private:
|
||||||
TEST_CASE( noerr1 );
|
TEST_CASE( noerr1 );
|
||||||
TEST_CASE( noerr2 );
|
TEST_CASE( noerr2 );
|
||||||
TEST_CASE( noerr3 );
|
TEST_CASE( noerr3 );
|
||||||
|
TEST_CASE( noerr4 );
|
||||||
// Todo: Fix this.
|
|
||||||
//TEST_CASE( noerr4 );
|
|
||||||
|
|
||||||
TEST_CASE( array_index_1 );
|
TEST_CASE( array_index_1 );
|
||||||
TEST_CASE( array_index_2 );
|
TEST_CASE( array_index_2 );
|
||||||
|
|
Loading…
Reference in New Issue