diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 1760c410c..8ba87b2c3 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -192,7 +192,7 @@ void CheckBufferOverrun::arrayIndex() const Token *stringLiteral = nullptr; - if (tok->variable()->dimensions().empty()) { + if (!tok->variable()->isArray() && tok->variable()->dimensions().empty()) { stringLiteral = tok->getValueTokenMinStrSize(); if (!stringLiteral) continue; diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 32deb0275..446700138 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -3324,7 +3324,7 @@ private: " char c[10] = \"c\";\n" " mymemset(c, 0, 10);\n" "}", settings); - // TODO ASSERT_EQUALS("", errout.str()); + ASSERT_EQUALS("", errout.str()); } void minsize_sizeof() {