logind: validate /sys fs path a bit more strictly

This commit is contained in:
Lennart Poettering 2019-04-30 13:47:52 +02:00
parent b0bd159f67
commit bda0613072
1 changed files with 2 additions and 0 deletions

View File

@ -1404,6 +1404,8 @@ static int method_attach_device(sd_bus_message *message, void *userdata, sd_bus_
if (r < 0)
return r;
if (!path_is_normalized(sysfs))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not normalized", sysfs);
if (!path_startswith(sysfs, "/sys"))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not in /sys", sysfs);