apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject svn commit: r239927 - /apr/apr/trunk/file_io/win32/filepath.c
Date Wed, 24 Aug 2005 21:09:58 GMT
Author: bnicholes
Date: Wed Aug 24 14:09:57 2005
New Revision: 239927

URL: http://svn.apache.org/viewcvs?rev=239927&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/trunk/file_io/win32/filepath.c

Modified: apr/apr/trunk/file_io/win32/filepath.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/win32/filepath.c?rev=239927&r1=239926&r2=239927&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filepath.c (original)
+++ apr/apr/trunk/file_io/win32/filepath.c Wed Aug 24 14:09:57 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