From 17248082ea70fbabf58e44fde182a8db1cc8f1c2 Mon Sep 17 00:00:00 2001 From: Sergei Lissianoi <54454955+selissia@users.noreply.github.com> Date: Wed, 12 Oct 2022 12:38:15 -0400 Subject: [PATCH] Add an assert to guard the FIXED_ENDPOINT_COUNT value (#23121) * Add an assert to guard the FIXED_ENDPOINT_COUNT value --- src/app/util/attribute-storage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 1d7b65e802735c..a3803a8cfbd58c 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -107,6 +107,9 @@ void emberAfEndpointConfigure(void) { uint16_t ep; + static_assert(FIXED_ENDPOINT_COUNT <= std::numeric_limits::max(), + "FIXED_ENDPOINT_COUNT must not exceed the size of the endpoint data type"); + #if !defined(EMBER_SCRIPTED_TEST) uint16_t fixedEndpoints[] = FIXED_ENDPOINT_ARRAY; uint16_t fixedDeviceTypeListLengths[] = FIXED_DEVICE_TYPE_LENGTHS;