From 5e2b8c43e4e645247c6ffef595e9e6e5dc449943 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Oct 2023 13:23:42 +1100 Subject: [PATCH] Fix invalid collection length for dummy unit collection While this didn't show up as a bug, if this length was used it could result in an out of bounds read. --- source/blender/blenkernel/intern/unit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/unit.cc b/source/blender/blenkernel/intern/unit.cc index bd872a874c3..c2e9f2d5f56 100644 --- a/source/blender/blenkernel/intern/unit.cc +++ b/source/blender/blenkernel/intern/unit.cc @@ -137,7 +137,7 @@ struct bUnitCollection { /* Dummy */ static bUnitDef buDummyDef[] = { {"", nullptr, "", nullptr, nullptr, nullptr, 1.0, 0.0}, NULL_UNIT}; -static bUnitCollection buDummyCollection = {buDummyDef, 0, 0, sizeof(buDummyDef)}; +static bUnitCollection buDummyCollection = {buDummyDef, 0, 0, UNIT_COLLECTION_LENGTH(buDummyDef)}; /* Lengths. */