You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Greg Onufer <gr...@cheers.Bungi> on 1997/09/03 20:40:27 UTC

mod_proxy/1092: '..' links from ftp proxy are often incorrect

>Number:         1092
>Category:       mod_proxy
>Synopsis:       '..' links from ftp proxy are often incorrect
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Sep  3 11:40:02 1997
>Originator:     greg@cheers.Bungi
>Organization:
apache
>Release:        1.2.4
>Environment:
SunOS 5.6, gcc 2.7.2.1.

>Description:
The page from an ftp url such as 'ftp://host/full/path/'
ends up with '..' pointing to 'ftp://host/full/path' since the
ftp code only strips off the last '/' in the path without first
stripping off a trailing '/'.
>How-To-Repeat:
See 'Full Description'.
>Fix:
This change to proxy_ftp.c seems to work:

@@ -340,6 +346,15 @@
                 strncpy(newpath, path, sizeof(newpath)-1);
                newpath[sizeof(newpath)-1] = '\0';
                 newfile=strrchr(newpath,'/');
+               if (newfile != NULL && newfile[1] == '\0') {
+                       /*
+                        * Remove a trailing '/' before stripping the last
+                        * component of the path or all we strip off is the
+                        * trailing slash.
+                        */
+                       *newfile = '\0';
+                       newfile=strrchr(newpath,'/');
+               }
                 if (newfile) *(newfile)=0;
                 else newpath[0]=0;
 
%0
>Audit-Trail:
>Unformatted: