From a624d76d01e3e20df1c948b598984b4fdbdbd03e Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 11 Aug 2005 03:53:25 +0000 Subject: [PATCH] Fix canonicalize_path so "../.." isn't stripped off and ignored. --- src/port/path.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/port/path.c b/src/port/path.c index a992094d4a..04118f78d3 100644 --- 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 */ -- 2.39.5