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 <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Mikael Kanstrup 2017-06-30 16:10:12 +02:00 committed by Michael Mann
parent b3453b9be4
commit 91e512985f
1 changed files with 2 additions and 0 deletions

View File

@ -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;