summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-16 13:56:31 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-16 13:58:26 -0500
commitd49dc8127676358e706663f3603265942d2507aa (patch)
treebe4692ade45c7719e799494083aca82820f4bbf1
parent8c340239a644faa16cb5c9396d89fcaefec409b9 (diff)
test-network: fix segfault with NULL dev_path/driver/type/name
-rw-r--r--src/libsystemd-network/network-internal.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index b6bddd9c60..81f90aa389 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -112,16 +112,20 @@ bool net_match_config(const struct ether_addr *match_mac,
if (match_mac && (!dev_mac || memcmp(match_mac, dev_mac, ETH_ALEN)))
return false;
- if (!strv_fnmatch_or_empty(dev_path, match_paths, 0))
+ if (!strv_isempty(match_paths) &&
+ (!dev_path || !strv_fnmatch(dev_path, match_paths, 0)))
return false;
- if (!strv_fnmatch_or_empty(dev_driver, match_drivers, 0))
+ if (!strv_isempty(match_drivers) &&
+ (!dev_driver || !strv_fnmatch(dev_driver, match_drivers, 0)))
return false;
- if (!strv_fnmatch_or_empty(dev_type, match_types, 0))
+ if (!strv_isempty(match_types) &&
+ (!dev_type || !strv_fnmatch_or_empty(dev_type, match_types, 0)))
return false;
- if (!strv_fnmatch_or_empty(dev_name, match_names, 0))
+ if (!strv_isempty(match_names) &&
+ (!dev_name || !strv_fnmatch_or_empty(dev_name, match_names, 0)))
return false;
return true;