tree-wide: use device_get_sysattr_safe_string()
The obtained strings are passed to another function, e,g, handled as a path and opened, printed to the terminal, written to a file, saved to udev database as udev property, exposed through DBus, passed to logger, and so on. Hence, these should not contain any malicious characters.
This commit is contained in:
@@ -281,7 +281,7 @@ static int validate_device(sd_device *device) {
|
||||
const char *other_sysname = NULL, *other_type = NULL;
|
||||
|
||||
(void) sd_device_get_sysname(other, &other_sysname);
|
||||
(void) sd_device_get_sysattr_value(other, "type", &other_type);
|
||||
(void) device_get_sysattr_safe_string(other, "type", &other_type);
|
||||
log_device_debug(device,
|
||||
"Found another %s backlight device %s on the same PCI, skipping.",
|
||||
strna(other_type), strna(other_sysname));
|
||||
@@ -295,7 +295,7 @@ static int validate_device(sd_device *device) {
|
||||
const char *other_sysname = NULL, *other_type = NULL;
|
||||
|
||||
(void) sd_device_get_sysname(other, &other_sysname);
|
||||
(void) sd_device_get_sysattr_value(other, "type", &other_type);
|
||||
(void) device_get_sysattr_safe_string(other, "type", &other_type);
|
||||
log_device_debug(device,
|
||||
"Found another %s backlight device %s, which has higher precedence, skipping.",
|
||||
strna(other_type), strna(other_sysname));
|
||||
|
||||
Reference in New Issue
Block a user