apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r382098 - /apr/apr/branches/0.9.x/file_io/win32/filepath.c
Date Wed, 01 Mar 2006 17:42:45 GMT
Author: wrowe
Date: Wed Mar  1 09:42:45 2006
New Revision: 382098

URL: http://svn.apache.org/viewcvs?rev=382098&view=rev
Log:

  Backport a basic optimization to address if a basepath 
  existed to compare the results to.  Backports: 382095

  Any further 'features' to support alternate constructs of
  NOTABOVEROOT tested base and add paths must be brought up
  on list for discussion.

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

Modified: apr/apr/branches/0.9.x/file_io/win32/filepath.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/file_io/win32/filepath.c?rev=382098&r1=382097&r2=382098&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/file_io/win32/filepath.c (original)
+++ apr/apr/branches/0.9.x/file_io/win32/filepath.c Wed Mar  1 09:42:45 2006
@@ -800,16 +800,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) {
+        if (memcmp(basepath, path + rootlen, baselen) != 0)
             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!
-         */
+ 
+         /* Ahem... if we have a basepath without a trailing slash,
+          * 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] != '\\')
+              && path[rootlen + baselen] && path[rootlen + baselen] != '/'

+                                         && path[rootlen + baselen] != '\\')
             return APR_EABOVEROOT;
     }
 



Mime
View raw message