Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6effc19

Browse files
committed
Document why we only handle trailing "..".
1 parent 721e537 commit 6effc19

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/port/path.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.52 2005/08/11 03:53:25 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.53 2005/08/12 02:48:37 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -284,7 +284,13 @@ canonicalize_path(char *path)
284284

285285
if (len > 2 && strcmp(path + len - 2, "/.") == 0)
286286
trim_directory(path);
287-
/* We can only deal with "/usr/local/..", not "/usr/local/../.." */
287+
/*
288+
* Process only a single trailing "..", and only if ".." does
289+
* not preceed it.
290+
* So, we only deal with "/usr/local/..", not with "/usr/local/../..".
291+
* We don't handle the even more complex cases, like
292+
* "usr/local/../../.." and "usr/local/../bin/../..".
293+
*/
288294
else if (len > 3 && strcmp(path + len - 3, "/..") == 0 &&
289295
(len != 5 || strcmp(path, "../..") != 0) &&
290296
(len < 6 || strcmp(path + len - 6, "/../..") != 0))

0 commit comments

Comments
 (0)