From c7d37b1d956d3d5fec63122ec58e4f28daaee5f1 Mon Sep 17 00:00:00 2001 From: localhorst Date: Sun, 7 Dec 2025 20:27:56 +0100 Subject: [PATCH] Missing Bounds Check on Array Access --- src/drive.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/drive.cpp b/src/drive.cpp index 78b99ed..5ae0b7e 100644 --- a/src/drive.cpp +++ b/src/drive.cpp @@ -62,6 +62,10 @@ string Drive::sCapacityToText() dSize /= 1000; u16UnitIndex++; } + if (u16UnitIndex >= 9) + { + u16UnitIndex = 8; + } int precision = (u16UnitIndex >= 3) ? (u16UnitIndex - 3) : 0; sprintf(acBuffer, "%.*f %s", precision, dSize, units[u16UnitIndex]); return acBuffer;