[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] CVS: proftpd/src fsio.c,1.83,1.84
From:       "TJ Saunders" <castaglia () users ! sourceforge ! net>
Date:       2009-09-29 20:50:30
Message-ID: E1Msjed-0006QW-LJ () ddv4jf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/proftp/proftpd/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24644/src

Modified Files:
	fsio.c 
Log Message:

Bug#3297 - Symlinks to directories which end in trailing slashes may not be
handled properly.


Index: fsio.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/fsio.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- fsio.c	10 Aug 2009 17:01:55 -0000	1.83
+++ fsio.c	29 Sep 2009 20:50:28 -0000	1.84
@@ -1590,13 +1590,13 @@
       }
 
       /* Handle "./" */
-      if (!strncmp(where, "./", 2)) {
+      if (strncmp(where, "./", 2) == 0) {
         where += 2;
         continue;
       }
 
       /* Handle "../" */
-      if (!strncmp(where, "../", 3)) {
+      if (strncmp(where, "../", 3) == 0) {
         where += 3;
         ptr = last = workpath;
 
@@ -1611,16 +1611,16 @@
       }
 
       ptr = strchr(where, '/');
-
-      if (!ptr) {
+      if (ptr == NULL) {
         size_t wherelen = strlen(where);
 
         ptr = where;
         if (wherelen >= 1)
           ptr += (wherelen - 1);
 
-      } else
+      } else {
         *ptr = '\0';
+      }
 
       sstrncpy(namebuf, workpath, sizeof(namebuf));
 
@@ -1669,6 +1669,10 @@
         if (*linkpath == '/')
           *workpath = '\0';
 
+        /* Trim any trailing slash. */
+        if (linkpath[len-1] == '/')
+          linkpath[len-1] = '\0';
+
         if (*linkpath == '~') {
           char tmpbuf[PR_TUNABLE_PATH_MAX + 1] = {'\0'};
 
@@ -1832,6 +1836,10 @@
         if (*linkpath == '/')
           *workpath = '\0';
 
+        /* Trim any trailing slash. */
+        if (linkpath[len-1] == '/')
+          linkpath[len-1] = '\0';
+
         if (*linkpath == '~') {
           char tmpbuf[PR_TUNABLE_PATH_MAX + 1] = {'\0'};
           *workpath = '\0';


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic