androiddump: Fix crash in add_tcpdump_interfaces
If there's a network interface on the device without the 'flags'
field and at the same time exist other network interfaces
with the 'flags' field present a null-dereference happens accessing
the non-matched regex flags field.
Fix crash by adding explicit null check to ensure (optional) regex
group really matched.
Fixes: 7dcf57719f
("androiddump: Support older on-target tcpdump versions")
Change-Id: Ia08dd8547c9cdda96b3c62b99d98ff1d85bd6cd2
Reviewed-on: https://code.wireshark.org/review/25198
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
0655931f60
commit
bde402840f
|
@ -929,7 +929,7 @@ static int add_tcpdump_interfaces(extcap_parameters * extcap_conf, const char *a
|
|||
gchar *iface = g_match_info_fetch_named(match, "iface");
|
||||
gchar *flags = g_match_info_fetch_named(match, "flags");
|
||||
|
||||
if (!flags_supported || strstr(flags, "Up")) {
|
||||
if (!flags_supported || (flags && strstr(flags, "Up"))) {
|
||||
g_snprintf(iface_name, sizeof(iface_name), INTERFACE_ANDROID_TCPDUMP_FORMAT, iface);
|
||||
new_interface(extcap_conf, iface_name, iface, serial_number, "Android tcpdump");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue