projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
32df2e1
)
path-util: use path_is_safe() in path_is_normalized()
author
Yu Watanabe
<watanabe.yu+github@gmail.com>
Fri, 30 Apr 2021 17:55:20 +0000
(
02:55
+0900)
committer
Yu Watanabe
<watanabe.yu+github@gmail.com>
Fri, 28 May 2021 04:41:23 +0000
(13:41 +0900)
src/basic/path-util.c
patch
|
blob
|
history
diff --git
a/src/basic/path-util.c
b/src/basic/path-util.c
index 48535da7256724a2d84d8c95eb04e0decd1c0b86..4b83232df882fd7796203b5c97add7be2a131fb0 100644
(file)
--- 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 (st
req(p, ".") || st
artswith(p, "./") || endswith(p, "/.") || strstr(p, "/./"))
return false;
if (strstr(p, "//"))