Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 55672 invoked from network); 20 Aug 2010 19:30:55 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Aug 2010 19:30:55 -0000 Received: (qmail 73182 invoked by uid 500); 20 Aug 2010 19:30:54 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 73052 invoked by uid 500); 20 Aug 2010 19:30:53 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 73044 invoked by uid 99); 20 Aug 2010 19:30:53 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Aug 2010 19:30:53 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of trawick@gmail.com designates 209.85.214.173 as permitted sender) Received: from [209.85.214.173] (HELO mail-iw0-f173.google.com) (209.85.214.173) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Aug 2010 19:30:30 +0000 Received: by iwn8 with SMTP id 8so2544759iwn.18 for ; Fri, 20 Aug 2010 12:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=iWL3PlrZc9qYdjegaTmzTkrBC1Fj/76MvTtZfYdpHsg=; b=XwP2VXd33Gktni5FRTO6GaH7LzSzv+T3oRxIk+RZFi3ydUy7lPrfGxJ/sveC0d5i/i d0Rh+/Fo36twOUNVPeUDAWH4db5NxuQpTfWWHG07PBpQ4ALldhKENcVUQ9NZZ1mlhi7s 3ATsWgStL70tMPVEQilJaCYoP9miPMdDp0p6E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Zy/J+YR0hrsLcdXcYTAISQ5BR9NXo9sb8vkAR+xHcHuipBEqZAGr6er7noQKPxdb34 JTZok5f9DFZDKrxMgWxdB+kYprJMf/+ctGBoKdViFI6fRYtwQy2lwFujT50TNOyupSlz l3NHqpR2T68/njyZJISGP6T4rGXDkMCH3c1ZI= MIME-Version: 1.0 Received: by 10.231.148.195 with SMTP id q3mr1875383ibv.199.1282332609908; Fri, 20 Aug 2010 12:30:09 -0700 (PDT) Received: by 10.231.49.199 with HTTP; Fri, 20 Aug 2010 12:30:09 -0700 (PDT) In-Reply-To: <20100818201012.649962388877@eris.apache.org> References: <20100818201012.649962388877@eris.apache.org> Date: Fri, 20 Aug 2010 15:30:09 -0400 Message-ID: Subject: Re: svn commit: r986901 - /httpd/httpd/trunk/server/core.c From: Jeff Trawick To: dev@httpd.apache.org Content-Type: multipart/alternative; boundary=0016e644ded8b29103048e46533b X-Virus-Checked: Checked by ClamAV on apache.org --0016e644ded8b29103048e46533b Content-Type: text/plain; charset=ISO-8859-1 On Wed, Aug 18, 2010 at 4:10 PM, wrote: > Author: sf > Date: Wed Aug 18 20:10:12 2010 > New Revision: 986901 > > URL: http://svn.apache.org/viewvc?rev=986901&view=rev > Log: > Perform NULL check before dereferencing arg, not after. > > PR: 49634 > > Modified: > httpd/httpd/trunk/server/core.c > > Modified: httpd/httpd/trunk/server/core.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=986901&r1=986900&r2=986901&view=diff > > ============================================================================== > --- httpd/httpd/trunk/server/core.c (original) > +++ httpd/httpd/trunk/server/core.c Wed Aug 18 20:10:12 2010 > @@ -1735,11 +1735,7 @@ static const char *dirsection(cmd_parms > > arg = apr_pstrndup(cmd->pool, arg, endp - arg); > > - if (!arg[0]) { > - return missing_container_arg(cmd); > - } > - > - if (!arg) { > + if (!arg || !arg[0]) { > if (thiscmd->cmd_data) > return " block must specify a path"; > else > Wasn't the right fix to simply remove the dead code below? (IOW, there was no dereference of a NULL pointer.) if ( !arg) { if (thiscmd->cmd_data) return " block must specify a path"; else return " block must specify a path"; } --0016e644ded8b29103048e46533b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Wed, Aug 18, 2010 at 4:10 PM, <sf@apache.org> wrote= :
Author: sf
Date: Wed Aug 18 20:10:12 2010
New Revision: 986901

URL: http://svn.apache.org/viewvc?rev=3D986901&view=3Drev
Log:
Perform NULL check before dereferencing arg, not after.

PR: 49634

Modified:
=A0 =A0httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/server/core.c
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=3D9= 86901&r1=3D986900&r2=3D986901&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Aug 18 20:10:12 2010
@@ -1735,11 +1735,7 @@ static const char *dirsection(cmd_parms

=A0 =A0 arg =3D apr_pstrndup(cmd->pool, arg, endp - arg);

- =A0 =A0if (!arg[0]) {
- =A0 =A0 =A0 =A0return missing_container_arg(cmd);
- =A0 =A0}
-
- =A0 =A0if (!arg) {
+ =A0 =A0if (!arg || !arg[0]) {
=A0 =A0 =A0 =A0 if (thiscmd->cmd_data)
=A0 =A0 =A0 =A0 =A0 =A0 return "<DirectoryMatch > block must sp= ecify a path";
=A0 =A0 =A0 =A0 else

Wasn't the right fix to = simply remove the dead code below?=A0 (IOW, there was no dereference of a N= ULL pointer.)

=A0=A0=A0 if ( !arg) {
=A0=A0=A0=A0=A0=A0=A0 if (th= iscmd->cmd_data)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return "<D= irectoryMatch > block must specify a path";
=A0=A0=A0=A0=A0=A0=A0 else
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return &quo= t;<Directory > block must specify a path";
=A0=A0=A0 }

--0016e644ded8b29103048e46533b--