ReplaceDotMess errors when backslashes are in an URL.

VERIFIED FIXED

Status

()

Core
Networking
P3
minor
VERIFIED FIXED
19 years ago
10 months ago

People

(Reporter: Daniel Bratell, Assigned: Gagan)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [PATCH] asked reporter)

Attachments

(1 attachment)

(Reporter)

Description

19 years ago
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
(Reporter)

Updated

19 years ago
Whiteboard: [PATCH]
(Reporter)

Comment 1

19 years ago
The above patch attached.
(Reporter)

Comment 2

19 years ago
Created attachment 1218 [details] [diff] [review]
Patch as in first comment.
(Assignee)

Updated

19 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 3

19 years ago
You are right! I must be sleepy to have missed that... I will apply the patch
and check it in soon. Thanks!
(Assignee)

Updated

19 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED

Updated

19 years ago
Whiteboard: [PATCH] → [PATCH] asked reporter

Comment 4

19 years ago
brattel, can you verify that your patch was applied? thanks
(Reporter)

Updated

19 years ago
Status: RESOLVED → VERIFIED
(Reporter)

Comment 5

19 years ago
It's applied ok.

Comment 6

18 years ago
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.