projects
/
users
/
bernd
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4f10d9f
)
Fix canonicalize_path so "../.." isn't stripped off and ignored.
author
Bruce Momjian
<bruce@momjian.us>
Thu, 11 Aug 2005 03:53:25 +0000
(
03:53
+0000)
committer
Bruce Momjian
<bruce@momjian.us>
Thu, 11 Aug 2005 03:53:25 +0000
(
03:53
+0000)
src/port/path.c
patch
|
blob
|
blame
|
history
diff --git
a/src/port/path.c
b/src/port/path.c
index a992094d4a8e86104bfcad5da8f131cb0e4aee6f..04118f78d30a9e7fd1f53e751f898b3cf09aed58 100644
(file)
--- a/
src/port/path.c
+++ b/
src/port/path.c
@@
-284,7
+284,10
@@
canonicalize_path(char *path)
if (len > 2 && strcmp(path + len - 2, "/.") == 0)
trim_directory(path);
- else if (len > 3 && strcmp(path + len - 3, "/..") == 0)
+ /* We can only deal with "/usr/local/..", not "/usr/local/../.." */
+ else if (len > 3 && strcmp(path + len - 3, "/..") == 0 &&
+ (len != 5 || strcmp(path, "../..") != 0) &&
+ (len < 6 || strcmp(path + len - 6, "/../..") != 0))
{
trim_directory(path);
trim_directory(path); /* remove directory above */