From 91e512985fac3f58986a8fdc322bcaf02f5e3685 Mon Sep 17 00:00:00 2001 From: Mikael Kanstrup Date: Fri, 30 Jun 2017 16:10:12 +0200 Subject: androiddump: Fix null dereference if linktype not found If linktype cannot be determined from tcpdump output the lookup function is handed a NULL which is then strcmp:ed. Handle NULL parameter by explicit check. Fixes Coverity CID 1413923 Change-Id: I290c116991d15cef0a1e954a9f8b76722a5f450c Reviewed-on: https://code.wireshark.org/review/22483 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- extcap/androiddump.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extcap/androiddump.c b/extcap/androiddump.c index ab145cbf4f..3e65902f6b 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -2311,6 +2311,8 @@ static int linktype_to_extcap_encap(const char* linktype) int i; int ret = EXTCAP_ENCAP_ETHERNET; + if (!linktype) + return ret; for (i = 0; lookup[i].dlt; i++) { if (!strcmp(lookup[i].dlt, linktype)) { ret = lookup[i].extcap_encap; -- cgit v1.2.1