|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $PostgreSQL: pgsql/src/port/path.c,v 1.51 2005/01/26 19:24:03 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/port/path.c,v 1.52 2005/08/11 03:53:25 momjian Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -284,7 +284,10 @@ canonicalize_path(char *path)
|
284 | 284 |
|
285 | 285 | if (len>2&&strcmp(path+len-2,"/.")==0)
|
286 | 286 | trim_directory(path);
|
287 |
| -elseif (len>3&&strcmp(path+len-3,"/..")==0) |
| 287 | +/* We can only deal with "/usr/local/..", not "/usr/local/../.." */ |
| 288 | +elseif (len>3&&strcmp(path+len-3,"/..")==0&& |
| 289 | + (len!=5||strcmp(path,"../..")!=0)&& |
| 290 | + (len<6||strcmp(path+len-6,"/../..")!=0)) |
288 | 291 | {
|
289 | 292 | trim_directory(path);
|
290 | 293 | trim_directory(path);/* remove directory above */
|
|