udev-event: check command is not empty before executing

This commit is contained in:
Yu Watanabe 2018-10-25 06:35:16 +09:00
parent e9343893f7
commit dc8aec36a6

View 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;