From f4024343a161f50b73f106dd3dea24d68a934d5a Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 21 Jul 2015 11:38:38 +0200 Subject: [PATCH] netsniff-ng: dissector_sll: Remove NULL check alltogether The check for pkt being NULL is not needed since the packet is allocated in dissector_entry_point() and panic()'s if the allocation fails. pkt->sll is also guaranteed to be non-NULL by all call sites of dissector_entry_point(). This is the proper fix for CIDs 1312074 and 1312075. Noticed-by: Daniel Borkmann Signed-off-by: Tobias Klauser --- dissector_sll.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/dissector_sll.c b/dissector_sll.c index a69a6a4c..ac8f017f 100644 --- a/dissector_sll.c +++ b/dissector_sll.c @@ -35,13 +35,9 @@ static char *pkt_type2str(uint8_t pkttype) static void sll_print_full(struct pkt_buff *pkt) { - struct sockaddr_ll *sll; + struct sockaddr_ll *sll = pkt->sll; char addr_str[40] = {}; - if (!pkt || !pkt->sll) - return; - - sll = pkt->sll; tprintf(" [ Linux \"cooked\""); tprintf(" Pkt Type %d (%s)", sll->sll_pkttype, pkt_type2str(sll->sll_pkttype)); @@ -69,13 +65,9 @@ static void sll_print_full(struct pkt_buff *pkt) static void sll_print_less(struct pkt_buff *pkt) { - struct sockaddr_ll *sll; + struct sockaddr_ll *sll = pkt->sll; char addr_str[40] = {}; - if (!pkt || !pkt->sll) - return; - - sll = pkt->sll; tprintf(" Pkt Type %d (%s)", sll->sll_pkttype, pkt_type2str(sll->sll_pkttype)); tprintf(", If Type %d (%s)", sll->sll_hatype, -- 2.11.4.GIT