summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-05-01 02:55:20 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-05-28 13:41:23 +0900
commit0b8696256ba3cd76af2a34184c7a95844304d6eb (patch)
treece8e7ef953a1af2297c5e5b8559ac39d78fdadbb /src
parent32df2e1447bb74ee20cff33ae7ff8aed080b8a91 (diff)
downloadsystemd-0b8696256ba3cd76af2a34184c7a95844304d6eb.tar.gz
path-util: use path_is_safe() in path_is_normalized()
Diffstat (limited to 'src')
-rw-r--r--src/basic/path-util.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index 48535da725..4b83232df8 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, "//"))