udev: specify the end of value

NULSTR_FOREACH may read the illegal match

Signed-off-by: gaoyi <ymuemc@163.com>
This commit is contained in:
gaoyi 2020-07-12 03:24:42 -04:00
parent d67b1d18fc
commit 1e67a9c2cd
1 changed files with 5 additions and 0 deletions

View 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;