From a59c0cac456b5b9b0e7720a8bf47c75a67f083e8 Mon Sep 17 00:00:00 2001 From: "andreas.otte%debitel.net" Date: Fri, 25 Jan 2002 22:07:50 +0000 Subject: [PATCH] fix bug 120959 [Use of ".." in address causes links to relative URL's to fail] A regression from the rewrite of the urlparser, r=dougt@netscape.com, sr=darin@netscape.com --- netwerk/base/src/nsURLParsers.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netwerk/base/src/nsURLParsers.cpp b/netwerk/base/src/nsURLParsers.cpp index 850628201cbb..621dd6495c0a 100644 --- a/netwerk/base/src/nsURLParsers.cpp +++ b/netwerk/base/src/nsURLParsers.cpp @@ -325,6 +325,10 @@ nsBaseURLParser::ParseFilePath(const char *filepath, PRInt32 filepathLen, for (p = end - 1; *p != '/' && p > filepath; --p) ; if (*p == '/') { + // catch /.. and /. + if ((p+1 < end && *(p+1) == '.') && + (p+2 == end || (p+2 < end && *(p+2) == '.' && p+3 == end))) + p = end - 1; // filepath = . SET_RESULT(directory, 0, p - filepath + 1); ParseFileName(p + 1, end - (p + 1),