diff options
author | Kay Sievers <kay@vrfy.org> | 2013-09-04 17:59:14 +0200 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2013-09-10 05:55:52 -0400 |
commit | 9e7943efd70683c3b4a828637e2f3288cd5bc796 (patch) | |
tree | e23b38ef4e6d1faa2e07473e0daa8fcf1f0c9716 | |
parent | libudev: enumerate: fix NULL-deref for subsystem-matches (diff) | |
download | eudev-9e7943efd70683c3b4a828637e2f3288cd5bc796.tar.gz eudev-9e7943efd70683c3b4a828637e2f3288cd5bc796.tar.bz2 eudev-9e7943efd70683c3b4a828637e2f3288cd5bc796.zip |
libudev: enumerate - do not try to match against an empty subsystem
-rw-r--r-- | src/libudev/libudev-enumerate.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c index 385829d46..bc1e37d34 100644 --- a/src/libudev/libudev-enumerate.c +++ b/src/libudev/libudev-enumerate.c @@ -721,12 +721,14 @@ static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *s { struct udev_list_entry *list_entry; - subsystem = subsystem ? : ""; + if (!subsystem) + return false; udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) return false; } + if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) @@ -734,6 +736,7 @@ static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *s } return false; } + return true; } |