summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorBruce Momjian2005-08-12 02:48:37 +0000
committerBruce Momjian2005-08-12 02:48:37 +0000
commit6effc19d9cab54f52ce0a68109542490fb8f6763 (patch)
tree13e7339098efc2f6b629caeb13c77d51bf50c1af /src/port
parent721e53785d837d48dc33dd68aa77c42ece7c9afb (diff)
Document why we only handle trailing "..".
Diffstat (limited to 'src/port')
-rw-r--r--src/port/path.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/port/path.c b/src/port/path.c
index 225ebdf43d..0890c95aa1 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.52 2005/08/11 03:53:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.53 2005/08/12 02:48:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -284,7 +284,13 @@ canonicalize_path(char *path)
if (len > 2 && strcmp(path + len - 2, "/.") == 0)
trim_directory(path);
- /* We can only deal with "/usr/local/..", not "/usr/local/../.." */
+ /*
+ * Process only a single trailing "..", and only if ".." does
+ * not preceed it.
+ * So, we only deal with "/usr/local/..", not with "/usr/local/../..".
+ * We don't handle the even more complex cases, like
+ * "usr/local/../../.." and "usr/local/../bin/../..".
+ */
else if (len > 3 && strcmp(path + len - 3, "/..") == 0 &&
(len != 5 || strcmp(path, "../..") != 0) &&
(len < 6 || strcmp(path + len - 6, "/../..") != 0))