From c16c12c70a6133c5e79fd9ffd870e469c570137b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 5 Nov 2008 23:49:46 +0000 Subject: [PATCH] Buffer overrun: Fixed a false positive --- CheckBufferOverrun.cpp | 4 ++-- testbufferoverrun.cpp | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CheckBufferOverrun.cpp b/CheckBufferOverrun.cpp index ca07a4b09..fcd16c9ef 100644 --- a/CheckBufferOverrun.cpp +++ b/CheckBufferOverrun.cpp @@ -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) diff --git a/testbufferoverrun.cpp b/testbufferoverrun.cpp index c346a196e..a8b3e471e 100644 --- a/testbufferoverrun.cpp +++ b/testbufferoverrun.cpp @@ -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 );