Skip to content

Commit

Permalink
packDev_t: Clear out uninitialized memory garbage
Browse files Browse the repository at this point in the history
If pDev is NULL (i.e. not found in associated devices list), only the first
2 bytes of the buffer (shortAddr) were filled (with INVALID_NODE_ADDR).
All the remaining buffer contained uninitialized memory garbage.
Hence the memset, to zero out the entire buffer beforehand.

See Koenkk/zigbee2mqtt#13478 (comment)

@slugzero

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
  • Loading branch information
oliv3r committed Aug 26, 2024
1 parent 4104d55 commit 251e0e0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/ti/zstack/mt/mt_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,8 @@ static void MT_UtilBindAddEntry(uint8_t *pBuf)
***************************************************************************************************/
static void packDev_t(uint8_t *pBuf, associated_devices_t *pDev)
{
memset(pBuf, 0, sizeof(associated_devices_t));

if (NULL == pDev)
{
uint16_t rtrn = INVALID_NODE_ADDR;
Expand Down

0 comments on commit 251e0e0

Please sign in to comment.