]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: specify the end of value
authorgaoyi <ymuemc@163.com>
Sun, 12 Jul 2020 07:24:42 +0000 (03:24 -0400)
committergaoyi <ymuemc@163.com>
Sun, 12 Jul 2020 07:24:42 +0000 (03:24 -0400)
NULSTR_FOREACH may read the illegal match

Signed-off-by: gaoyi <ymuemc@163.com>
src/udev/udev-rules.c

index 4efafffd4081f01c614d4200cee58e1f80e88c6f..2d4eb3d3414c51118fb3f2ad3493f44b8d81ed75 100644 (file)
@@ -452,6 +452,11 @@ static int rule_line_add_token(UdevRuleLine *rule_line, UdevRuleTokenType type,
                                 }
                         }
                         *b = '\0';
+
+                        /* Make sure the value is end, so NULSTR_FOREACH can read correct match */
+                        if (b < a)
+                                b[1] = '\0';
+
                         if (bar)
                                 empty = true;