postgres.git / summary / log / commit / refs
commit 6a60357588f873ff2f8a7dfeb94526c4af6c2b92
Author: Bruce Momjian <bruce@momjian.us>
Date: Thu Aug 11 03:53:25 2005 +0000
First released in: 8.1.0
Fix canonicalize_path so "../.." isn't stripped off and ignored.
src/port/path.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/port/path.c b/src/port/path.c
index 4736973ed1f..225ebdf43d0 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.51 2005/01/26 19:24:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.52 2005/08/11 03:53:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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 */
[parent: 24ff62d76f02]