]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: use string_is_safe() at one more place
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 May 2026 16:17:42 +0000 (01:17 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 May 2026 16:57:33 +0000 (01:57 +0900)
src/libsystemd/sd-device/sd-device.c

index 9d9ac7d4300f9d718bb240abf7cc19558af9c07f..307137b431a8b99492d76831604e5587f3ef69e7 100644 (file)
@@ -31,7 +31,6 @@
 #include "string-util.h"
 #include "strv.h"
 #include "time-util.h"
-#include "utf8.h"
 
 int device_new_aux(sd_device **ret) {
         sd_device *device;
@@ -97,10 +96,10 @@ static bool property_is_valid(const char *key, const char *value) {
                 return true;
 
         /* refuse invalid UTF8 and control characters */
-        if (!utf8_is_valid(value) || string_has_cc(value, /* ok= */ NULL))
-                return false;
-
-        return true;
+        return string_is_safe(value,
+                              STRING_ALLOW_BACKSLASHES |
+                              STRING_ALLOW_QUOTES |
+                              STRING_ALLOW_GLOBS);
 }
 
 int device_add_property_aux(sd_device *device, const char *key, const char *value, bool db) {