summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaoyi <ymuemc@163.com>2020-07-12 03:24:42 -0400
committergaoyi <ymuemc@163.com>2020-07-12 03:24:42 -0400
commit1e67a9c2cd6065b850d2fd5e376d8b9bff63bdbc (patch)
tree3534ad9cc580e667521211f02500929daed40cef
parentd67b1d18fcda2c8c5aacfc50f9591c8dc7a4a8a1 (diff)
downloadsystemd-1e67a9c2cd6065b850d2fd5e376d8b9bff63bdbc.tar.gz
udev: specify the end of value
NULSTR_FOREACH may read the illegal match Signed-off-by: gaoyi <ymuemc@163.com>
-rw-r--r--src/udev/udev-rules.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 4efafffd40..2d4eb3d341 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -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;