From commits-return-6954-apmail-apr-commits-archive=apr.apache.org@apr.apache.org Thu Aug 25 14:55:18 2005 Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 45347 invoked from network); 25 Aug 2005 14:55:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Aug 2005 14:55:18 -0000 Received: (qmail 15136 invoked by uid 500); 25 Aug 2005 14:55:06 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 14977 invoked by uid 500); 25 Aug 2005 14:55:06 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 14950 invoked by uid 99); 25 Aug 2005 14:55:05 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 25 Aug 2005 07:55:05 -0700 Received: (qmail 45329 invoked by uid 65534); 25 Aug 2005 14:55:05 -0000 Message-ID: <20050825145505.45328.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r240085 - /apr/apr/branches/1.2.x/file_io/win32/filepath.c Date: Thu, 25 Aug 2005 14:55:05 -0000 To: commits@apr.apache.org From: bnicholes@apache.org X-Mailer: svnmailer-1.0.3 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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; }