Closed Bug 11726 Opened 25 years ago Closed 25 years ago

ReplaceDotMess errors when backslashes are in an URL.

Categories

(Core :: Networking, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: bratell, Assigned: gagan)

Details

(Whiteboard: [PATCH] asked reporter)

Attachments

(1 file)

Overview Description:

If slash and backslash should be treated the same in a path as suggested by the
fix to bug 8573, then there are a few trivial errors in functionality in
|nsStdUrl|s ReplaceDotMess function where the lookahead doesn't take backslashes
into account. Because it's a look ahead the backslashes are still there since
they're not converted yet.


Patch to fix (against nsStdURL.cpp v1.11):

Index: nsStdURL.cpp
===================================================================
RCS file: /cvsroot/mozilla/netwerk/base/src/nsStdURL.cpp,v
retrieving revision 1.11
diff -u -r1.11 nsStdURL.cpp
--- nsStdURL.cpp        1999/08/12 09:59:24     1.11
+++ nsStdURL.cpp        1999/08/12 12:17:47
@@ -933,15 +933,19 @@

     for(; *fwdPtr != '\0'; ++fwdPtr)
     {
+        // Replace \ with /
                if (*fwdPtr == '\\')
                        *fwdPtr = '/';
-        if (*fwdPtr == '/' && *(fwdPtr+1) == '.' && *(fwdPtr+2) == '/')
+
+        if (*fwdPtr == '/' && *(fwdPtr+1) == '.' &&
+            (*(fwdPtr+2) == '/' || *(fwdPtr+2) == '\\'))
         {
-            // remove ./
+            // remove /. if followed by a slash or backslash
             fwdPtr += 1;
         }
         else if(*fwdPtr == '/' && *(fwdPtr+1) == '.' && *(fwdPtr+2) == '.' &&
-                (*(fwdPtr+3) == '/' || *(fwdPtr+3) == '\0'))
+                (*(fwdPtr+3) == '/' || *(fwdPtr+3) == '\\' ||
+                 *(fwdPtr+3) == '\0'))
         {
             // remove foo/..
             // reverse the urlPtr to the previous slash
Whiteboard: [PATCH]
The above patch attached.
Status: NEW → ASSIGNED
You are right! I must be sleepy to have missed that... I will apply the patch
and check it in soon. Thanks!
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Whiteboard: [PATCH] → [PATCH] asked reporter
brattel, can you verify that your patch was applied? thanks
Status: RESOLVED → VERIFIED
It's applied ok.
Bulk move of all Networking-Core (to be deleted component) bugs to new
Networking component.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: