udev: prepare memory for extra NUL termination for NULSTR
Fixes: #15162
This commit is contained in:
parent
2d69cf6eb0
commit
cd3c8a117c
|
@ -1092,7 +1092,9 @@ static int rule_add_line(UdevRules *rules, const char *line_str, unsigned line_n
|
|||
if (isempty(line_str))
|
||||
return 0;
|
||||
|
||||
line = strdup(line_str);
|
||||
/* We use memdup_suffix0() here, since we want to add a second NUL byte to the end, since possibly
|
||||
* some parsers might turn this into a "nulstr", which requires an extra NUL at the end. */
|
||||
line = memdup_suffix0(line_str, strlen(line_str) + 1);
|
||||
if (!line)
|
||||
return log_oom();
|
||||
|
||||
|
|
Loading…
Reference in New Issue