apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r382095 - /apr/apr/trunk/file_io/win32/filepath.c
Date Wed, 01 Mar 2006 17:41:23 GMT
Author: wrowe
Date: Wed Mar  1 09:41:22 2006
New Revision: 382095

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

  Revert 239927 and simplify a much more basic optimization
  to address if a basepath existed to compare the results to.
  Also reverts my attempt 382043 to fix the flaw.

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

PR: 38801
Reported by: <kevin_wise motorola.com>

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=382095&r1=382094&r2=382095&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filepath.c (original)
+++ apr/apr/trunk/file_io/win32/filepath.c Wed Mar  1 09:41:22 2006
@@ -800,18 +800,17 @@
      * is still within given basepath.  Note that the root path 
      * segment is thoroughly tested prior to path parsing.
      */
-    if ((flags & APR_FILEPATH_NOTABOVEROOT) && (baselen || rootlen)) {
-        if (basepath[baselen - 1] != '/' && basepath[baselen - 1] != '\\') {
-            if (baselen && memcmp(basepath, path + rootlen, baselen))
-                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 (path[rootlen + baselen] && path[rootlen + baselen] != '/' 
-                                        && path[rootlen + baselen] != '\\')
-                return APR_EABOVEROOT;
-        }
+    if ((flags & APR_FILEPATH_NOTABOVEROOT) && baselen) {
+        if (memcmp(basepath, path + rootlen, baselen) != 0)
+            return APR_EABOVEROOT;
+ 
+         /* 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] != '\\')
+            return APR_EABOVEROOT;
     }
 
     if (addpath && (flags & APR_FILEPATH_TRUENAME)) {



Mime
View raw message