monitor: Fix uninitiailzed scalar variable
authorTedd Ho-Jeong An <tedd.an@intel.com>
Sat, 13 Nov 2021 02:35:58 +0000 (18:35 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:38 +0000 (19:08 +0530)
This patch fixes the uninitiailzed varialble(CWE-457) reported by
the Coverity scan.

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

index 40250ce..70e7e1d 100755 (executable)
@@ -436,6 +436,7 @@ void rfcomm_packet(const struct l2cap_frame *frame)
        if (frame->size < 4)
                goto fail;
 
+       memset(&hdr, 0, sizeof(hdr));
        if (!l2cap_frame_get_u8(l2cap_frame, &hdr.address) ||
                        !l2cap_frame_get_u8(l2cap_frame, &hdr.control) ||
                        !l2cap_frame_get_u8(l2cap_frame, &length))