From b06ab67ff1b1a12ca86183df7ecf37f832b3a3f9 Mon Sep 17 00:00:00 2001 From: gaoyi Date: Sun, 12 Jul 2020 03:24:42 -0400 Subject: [PATCH] udev: specify the end of value NULSTR_FOREACH may read the illegal match Signed-off-by: gaoyi (cherry picked from commit 1e67a9c2cd6065b850d2fd5e376d8b9bff63bdbc) --- src/udev/udev-rules.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 04e1c976fb..d1a5f3f8ff 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; -- 2.25.1