Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BFA6A10445 for ; Thu, 17 Oct 2013 16:20:19 +0000 (UTC) Received: (qmail 76175 invoked by uid 500); 17 Oct 2013 16:20:17 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 75998 invoked by uid 500); 17 Oct 2013 16:20:17 -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 75990 invoked by uid 99); 17 Oct 2013 16:20:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 16:20:17 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [76.96.30.24] (HELO qmta02.emeryville.ca.mail.comcast.net) (76.96.30.24) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 16:20:09 +0000 Received: from omta20.emeryville.ca.mail.comcast.net ([76.96.30.87]) by qmta02.emeryville.ca.mail.comcast.net with comcast id eFAq1m0031smiN4A2GKnxy; Thu, 17 Oct 2013 16:19:47 +0000 Received: from [192.168.199.10] ([69.251.80.74]) by omta20.emeryville.ca.mail.comcast.net with comcast id eGKl1m0051cCKD98gGKmW7; Thu, 17 Oct 2013 16:19:47 +0000 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1812\)) Subject: Re: svn commit: r1533100 - /httpd/httpd/trunk/modules/proxy/proxy_util.c From: Jim Jagielski In-Reply-To: Date: Thu, 17 Oct 2013 12:19:44 -0400 Content-Transfer-Encoding: 7bit Message-Id: <38D341DB-AAEF-483D-970C-56D929CA5EF9@jaguNET.com> References: <20131017150205.0A0442388868@eris.apache.org> To: dev@httpd.apache.org X-Mailer: Apple Mail (2.1812) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1382026787; bh=KAt9RAaapPA5HoMAByVQv8Lyk9GLhdrDvWcp6Pl5JJM=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To; b=KrEjC0tvfNNqnlN8x82CLU/kW0IrJGblmj4ggnKlzQxuudQ09+asgJHol/2fNZk7m jg2HXenQNI3lZlCIBg57TSH2197ruV2VyQvjJ2Ccp1sqCcEp2SEruYgmaCrlgAJ8Aj tewEGx32S1aQxb2koIAE4gIqaRqNiQCW1pVdXj0v2u6wwKUIp/PLYlwDfAMYYEnIFt WS0TZjs9MsFgIIML2jCdDq/h9w3eUE/0KhwfBjWM811BlDNhOlATTmb/91WhwlzbvV smcQCvjZWncyfaIbY0tsXgCqVIe5IUwFYuLIyASloqjv4FINWnkGZX5IeR07hlvADM WDna5+KFW3mEQ== X-Virus-Checked: Checked by ClamAV on apache.org Need to look, but at 1st blush it looks like an off-by-1 error there. On Oct 17, 2013, at 11:33 AM, Yann Ylavic wrote: > > Maybe ap_proxy_strncpy() could aso have no "slow" path with this change : > > Index: modules/proxy/proxy_util.c > =================================================================== > --- modules/proxy/proxy_util.c (revision 1533118) > +++ modules/proxy/proxy_util.c (working copy) > @@ -90,7 +90,6 @@ APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, > PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src, > apr_size_t dlen) > { > - char *thenil; > apr_size_t thelen; > > /* special case: really apr_cpystrn should handle src==NULL*/ > @@ -98,11 +97,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char > *dst = '\0'; > return APR_SUCCESS; > } > - thenil = apr_cpystrn(dst, src, dlen); > - thelen = thenil - dst; > - /* Assume the typical case is smaller copying into bigger > - so we have a fast return */ > - if ((thelen < dlen-1) || ((strlen(src)) == thelen)) { > + thelen = apr_cpystrn(dst, src, dlen) - dst; > + if (thelen < dlen || !src[dlen]) { > return APR_SUCCESS; > } > /* XXX: APR_ENOSPACE would be better */ > [EOS] > > Regards, > Yann. >