From b01e84af986920d34199a68eb10b878d5f85d424 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Wed, 28 Feb 2018 23:37:47 -0800 Subject: [PATCH] raw: Fix valgrind setsockopt warning. Valgrind is nagging us, saying we pass uninitialized data through a setsockopt() call. This patch fixes the issue by clearing the entire passed structure. Signed-off-by: Richard Cochran --- raw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/raw.c b/raw.c index 8b7bcf1..d9a3468 100644 --- a/raw.c +++ b/raw.c @@ -103,6 +103,7 @@ static int raw_configure(int fd, int event, int index, option = enable ? PACKET_ADD_MEMBERSHIP : PACKET_DROP_MEMBERSHIP; + memset(&mreq, 0, sizeof(mreq)); mreq.mr_ifindex = index; mreq.mr_type = PACKET_MR_MULTICAST; mreq.mr_alen = MAC_LEN;