Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 90627 invoked from network); 1 Mar 2006 23:39:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Mar 2006 23:39:38 -0000 Received: (qmail 20957 invoked by uid 500); 1 Mar 2006 23:40:24 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 20914 invoked by uid 500); 1 Mar 2006 23:40:23 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 20903 invoked by uid 99); 1 Mar 2006 23:40:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Mar 2006 15:40:23 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [207.155.252.7] (HELO illustrious.cnchost.com) (207.155.252.7) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Mar 2006 15:40:21 -0800 Received: from [192.168.0.21] (c-24-13-128-132.hsd1.il.comcast.net [24.13.128.132]) by illustrious.cnchost.com id SAA05866; Wed, 1 Mar 2006 18:40:00 -0500 (EST) [ConcentricHost SMTP Relay 1.17] Errors-To: Message-ID: <4406303F.2040808@rowe-clan.net> Date: Wed, 01 Mar 2006 17:37:35 -0600 From: "William A. Rowe, Jr." User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@apr.apache.org Subject: [Fwd: svn commit: r382095 - /apr/apr/trunk/file_io/win32/filepath.c] Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Brad and I spent quite a bit of time this afternoon on what the original code and new code do. It raised a very interesting question. If I, the developer, combine a relative -or- empty left hand side expression and add a path that's *absolute*, but flagged the apr_filepath_merge as APR_FILEPATH_NOTABOVEROOT, what happens? My thought is that an empty or null left-hand side expression should correspond conceptually to the cwd, or a totally unrooted location. If that's true, then merging an absolute addpath should fail as above root(!) What say you all? Bill -------- Original Message -------- Subject: svn commit: r382095 - /apr/apr/trunk/file_io/win32/filepath.c Date: Wed, 01 Mar 2006 17:41:23 -0000 From: wrowe@apache.org Reply-To: dev@apr.apache.org To: commits@apr.apache.org 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: 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)) {