From 17253cdb55e8c944de4f333eff0f092133a33a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 11 Mar 2019 19:40:17 +0100 Subject: [PATCH] buffer overflow: Fix false positive --- lib/checkbufferoverrun.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 5a48e65a2..1760c410c 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -291,6 +291,8 @@ size_t CheckBufferOverrun::getBufferSize(const Token *bufTok) const MathLib::bigint dim = 1; for (const Dimension &d : var->dimensions()) dim *= d.num; + if (var->isPointerArray()) + return dim * mSettings->sizeof_pointer; switch (bufTok->valueType()->type) { case ValueType::Type::BOOL: return dim * mSettings->sizeof_bool;