From: Lennart Poettering Date: Thu, 7 Mar 2019 09:37:04 +0000 (+0100) Subject: path-util: check validity before normalization in path_simplify_and_warn() X-Git-Tag: v242-rc1~155^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=458e60b3a91cfeb72163a312187ce672a9c4dfe0;p=thirdparty%2Fsystemd.git path-util: check validity before normalization in path_simplify_and_warn() As the normalization check includes a validation check the order matters. --- diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 221517303ec..084e0a9f29d 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -1132,17 +1132,17 @@ int path_simplify_and_warn( path_simplify(path, true); - if (!path_is_normalized(path)) { + if (!path_is_valid(path)) { log_syntax(unit, LOG_ERR, filename, line, 0, - "%s= path is not normalized%s: %s", - lvalue, fatal ? "" : ", ignoring", path); + "%s= path has invalid length (%zu bytes)%s.", + lvalue, strlen(path), fatal ? "" : ", ignoring"); return -EINVAL; } - if (!path_is_valid(path)) { + if (!path_is_normalized(path)) { log_syntax(unit, LOG_ERR, filename, line, 0, - "%s= path has invalid length (%zu bytes)%s.", - lvalue, strlen(path), fatal ? "" : ", ignoring"); + "%s= path is not normalized%s: %s", + lvalue, fatal ? "" : ", ignoring", path); return -EINVAL; }