From: Yu Watanabe Date: Fri, 30 Apr 2021 17:55:20 +0000 (+0900) Subject: path-util: use path_is_safe() in path_is_normalized() X-Git-Tag: v249-rc1~131^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0b8696256ba3cd76af2a34184c7a95844304d6eb;p=thirdparty%2Fsystemd.git path-util: use path_is_safe() in path_is_normalized() --- diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 48535da7256..4b83232df88 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -1057,17 +1057,10 @@ bool path_is_valid_full(const char *p, bool accept_dot_dot) { } bool path_is_normalized(const char *p) { - - if (!path_is_valid(p)) - return false; - - if (dot_or_dot_dot(p)) - return false; - - if (startswith(p, "../") || endswith(p, "/..") || strstr(p, "/../")) + if (!path_is_safe(p)) return false; - if (startswith(p, "./") || endswith(p, "/.") || strstr(p, "/./")) + if (streq(p, ".") || startswith(p, "./") || endswith(p, "/.") || strstr(p, "/./")) return false; if (strstr(p, "//"))