From bee73f5d049c5436ffff87a7e0c5eab600e8df28 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 12 Apr 2016 08:45:20 +0200 Subject: sshdump,ciscodump: fix local addresses discovery Fixes a NULL-deref when no interface addresses are discovered. Remove NULL interface from list (an empty GSList is represented by NULL while g_slist_alloc returns a list with a single NULL data). Change-Id: I2eded40bb697e051445a526d1f34d8a50ef9ccd4 Reviewed-on: https://code.wireshark.org/review/14888 Petri-Dish: Peter Wu Reviewed-by: Dario Lombardo Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu --- extcap/sshdump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'extcap/sshdump.c') diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 77dc11ad04..92ea9fded0 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -268,9 +268,9 @@ static char* interfaces_list_to_filter(GSList* interfaces, unsigned int remote_p } else { g_string_append_printf(filter, "not ((host %s", (char*)interfaces->data); cur = g_slist_next(interfaces); - while (cur->next != NULL) { + while (cur) { g_string_append_printf(filter, " or host %s", (char*)cur->data); - cur = cur->next; + cur = g_slist_next(cur); } g_string_append_printf(filter, ") and port %u)", remote_port); } -- cgit v1.2.1