]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-event: check command is not empty before executing
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 24 Oct 2018 21:35:16 +0000 (06:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 26 Oct 2018 22:03:39 +0000 (07:03 +0900)
src/udev/udev-event.c

index 2125a6fa0dc4cc7cc67662b1c126c294f3f04099..125b4005b1a3fb434224dfaf03f528d0e32640f7 100644 (file)
@@ -586,6 +586,8 @@ int udev_event_spawn(struct udev_event *event,
         pid_t pid;
         int r;
 
+        assert(event);
+        assert(event->dev);
         assert(result || ressize == 0);
 
         /* pipes from child to parent */
@@ -601,6 +603,11 @@ int udev_event_spawn(struct udev_event *event,
         if (!argv)
                 return log_oom();
 
+        if (isempty(argv[0])) {
+                log_error("Invalid command '%s'", cmd);
+                return -EINVAL;
+        }
+
         /* allow programs in /usr/lib/udev/ to be called without the path */
         if (!path_is_absolute(argv[0])) {
                 char *program;