Skip to content

Commit

Permalink
Fix casts when determining endpoint indices.
Browse files Browse the repository at this point in the history
Not everything got updated correctly when endpoint indices changed from uint8 to
uint16.

Fixes #36007
  • Loading branch information
bzbarsky-apple committed Oct 11, 2024
1 parent 7287041 commit cb234d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ uint16_t emberAfGetDynamicIndexFromEndpoint(EndpointId id)
{
if (emAfEndpoints[index].endpoint == id)
{
return static_cast<uint8_t>(index - FIXED_ENDPOINT_COUNT);
return static_cast<uint16_t>(index - FIXED_ENDPOINT_COUNT);
}
}
return kEmberInvalidEndpointIndex;
Expand Down Expand Up @@ -322,7 +322,7 @@ EndpointId emberAfClearDynamicEndpoint(uint16_t index)
{
EndpointId ep = 0;

index = static_cast<uint8_t>(index + FIXED_ENDPOINT_COUNT);
index = static_cast<uint16_t>(index + FIXED_ENDPOINT_COUNT);

if ((index < MAX_ENDPOINT_COUNT) && (emAfEndpoints[index].endpoint != kInvalidEndpointId) &&
(emberAfEndpointIndexIsEnabled(index)))
Expand Down

0 comments on commit cb234d9

Please sign in to comment.