When parsing paths, reject anything above PATH_MAX

The check for length is done after path_simplify(), to be nice to paths which
are constructed using specifiers, and have duplicate slashes and stuff.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-12-10 11:57:26 +01:00
parent 9b674e2581
commit 296acffe45
+7
View File
@@ -1139,5 +1139,12 @@ int path_simplify_and_warn(
return -EINVAL;
}
if (!path_is_valid(path)) {
log_syntax(unit, LOG_ERR, filename, line, 0,
"%s= path has invalid length (%zu bytes)%s.",
lvalue, strlen(path), fatal ? "" : ", ignoring");
return -EINVAL;
}
return 0;
}