1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-06 01:57:47 +03:00

sd-device: validate devnum parameters in device_set_devnum()

This commit is contained in:
Lennart Poettering 2022-04-05 10:19:20 +02:00
parent 4d960d0bdb
commit 9d41c62f6e

View File

@ -585,11 +585,15 @@ int device_set_devnum(sd_device *device, const char *major, const char *minor) {
return r;
if (maj == 0)
return 0;
if (!DEVICE_MAJOR_VALID(maj))
return -EINVAL;
if (minor) {
r = safe_atou(minor, &min);
if (r < 0)
return r;
if (!DEVICE_MINOR_VALID(min))
return -EINVAL;
}
r = device_add_property_internal(device, "MAJOR", major);