apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject svn commit: r240085 - /apr/apr/branches/1.2.x/file_io/win32/filepath.c
Date Thu, 25 Aug 2005 14:55:05 GMT
Author: bnicholes
Date: Thu Aug 25 07:55:04 2005
New Revision: 240085

URL: http://svn.apache.org/viewcvs?rev=240085&view=rev
Log:
Don't bother checking empty strings when we already know that the string length is 0. This
fixes a false error code of APR_EABOVEROOT when the result of the merge is just a file name
with no path of any kind.

Modified:
    apr/apr/branches/1.2.x/file_io/win32/filepath.c

Modified: apr/apr/branches/1.2.x/file_io/win32/filepath.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/file_io/win32/filepath.c?rev=240085&r1=240084&r2=240085&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/file_io/win32/filepath.c (original)
+++ apr/apr/branches/1.2.x/file_io/win32/filepath.c Thu Aug 25 07:55:04 2005
@@ -803,16 +803,16 @@
      * is still within given basepath.  Note that the root path 
      * segment is thoroughly tested prior to path parsing.
      */
-    if (flags & APR_FILEPATH_NOTABOVEROOT) {
-        if (memcmp(basepath, path + rootlen, baselen))
+    if ((flags & APR_FILEPATH_NOTABOVEROOT) && (baselen || rootlen)) {
+        if (baselen && memcmp(basepath, path + rootlen, baselen) &&
+            basepath[baselen - 1] != '/' && basepath[baselen - 1] != '\\')
             return APR_EABOVEROOT;
 
         /* Ahem... if we weren't given a trailing slash on the basepath,
          * we better be sure that /foo wasn't replaced with /foobar!
          */
-        if (basepath[baselen - 1] != '/' && basepath[baselen - 1] != '\\'
-                && path[rootlen + baselen] && path[rootlen + baselen] !=
'/' 
-                                           && path[rootlen + baselen] != '\\')
+        if (path[rootlen + baselen] && path[rootlen + baselen] != '/' 
+            && path[rootlen + baselen] != '\\')
             return APR_EABOVEROOT;
     }
 



Mime
View raw message