From 4cadf4dd5dc757510c7cda7a26cd1e4691c7f5c9 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 30 Apr 2014 09:35:48 +0000 Subject: [PATCH] Fix an unassigned memory error. --- if-linux.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/if-linux.c b/if-linux.c index ad52bba7..0a272561 100644 --- a/if-linux.c +++ b/if-linux.c @@ -773,9 +773,6 @@ if_openrawsocket(struct interface *ifp, int protocol) return -1; } #endif - su.sll.sll_family = PF_PACKET; - su.sll.sll_protocol = htons(protocol); - su.sll.sll_ifindex = (int)ifp->index; /* Install the DHCP filter */ memset(&pf, 0, sizeof(pf)); if (protocol == ETHERTYPE_ARP) { @@ -794,6 +791,11 @@ if_openrawsocket(struct interface *ifp, int protocol) goto eexit; } #endif + + memset(&su, 0, sizeof(su)); + su.sll.sll_family = PF_PACKET; + su.sll.sll_protocol = htons(protocol); + su.sll.sll_ifindex = (int)ifp->index; if (bind(s, &su.sa, sizeof(su)) == -1) goto eexit; return s; -- 2.47.3