mesh: Fix segmented msg RX with friendship
authorBrian Gix <brian.gix@intel.com>
Wed, 24 Mar 2021 19:34:12 +0000 (12:34 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:35 +0000 (19:08 +0530)
This fixes an uninitialized memory issue where a message received for
a local node is silently discarded if an uninitialized boolean is
mistakenly set to TRUE, when friendships exist.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
mesh/net.c

index 6c7f304..505f859 100644 (file)
@@ -1163,6 +1163,7 @@ static struct mesh_friend_msg *mesh_friend_msg_new(uint8_t seg_max)
 
                size += (seg_max + 1) * sizeof(struct mesh_friend_seg_12);
                frnd_msg = l_malloc(size);
+               memset(frnd_msg, 0, size);
        } else
                frnd_msg = l_new(struct mesh_friend_msg, 1);