mirror of
https://github.com/systemd/systemd.git
synced 2026-08-09 01:20:53 +00:00
sysupdate: allow long CurrentSymlink= paths
CurrentSymlink= accepts a symlink path, but the parser used NAME_MAX
for specifier expansion. Absolute and target-relative paths can be
longer than one filename component while still staying below PATH_MAX.
Reproducer: configure CurrentSymlink= to a path longer than NAME_MAX
and run systemd-sysupdate list with debug logging.
Before: sysupdate logged that CurrentSymlink= specifier expansion
failed and ignored the setting.
After: the transfer parses cleanly and list emits no CurrentSymlink=
specifier expansion warning.
Follow-up for: 43cc7a3ef4
This commit is contained in:
@@ -238,7 +238,12 @@ static int config_parse_current_symlink(
|
||||
|
||||
assert(rvalue);
|
||||
|
||||
r = specifier_printf(rvalue, NAME_MAX, system_and_tmp_specifier_table, t->context->root, NULL, &resolved);
|
||||
if (isempty(rvalue)) {
|
||||
*current_symlink = mfree(*current_symlink);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = specifier_printf(rvalue, PATH_MAX-1, system_and_tmp_specifier_table, t->context->root, NULL, &resolved);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to expand specifiers in CurrentSymlink=, ignoring: %s", rvalue);
|
||||
|
||||
Reference in New Issue
Block a user