Skip to content

Commit

Permalink
Add an assert to guard the FIXED_ENDPOINT_COUNT value (#23121)
Browse files Browse the repository at this point in the history
* Add an assert to guard the FIXED_ENDPOINT_COUNT value
  • Loading branch information
selissia authored and pull[bot] committed Dec 5, 2022
1 parent 02cc0df commit 1163272
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ void emberAfEndpointConfigure(void)
{
uint16_t ep;

static_assert(FIXED_ENDPOINT_COUNT <= std::numeric_limits<decltype(ep)>::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;
Expand Down

0 comments on commit 1163272

Please sign in to comment.