Re: svn commit: r1533169 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

2013-10-18 Thread Ruediger Pluem


j...@apache.org wrote:
 Author: jim
 Date: Thu Oct 17 17:21:04 2013
 New Revision: 1533169
 
 URL: http://svn.apache.org/r1533169
 Log:
 from an idea by Yann Ylavic ylavic@gmail.com
 
 Modified:
 httpd/httpd/trunk/modules/proxy/proxy_util.c
 
 Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
 URL: 
 http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1533169r1=1533168r2=1533169view=diff
 ==
 --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
 +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Thu Oct 17 17:21:04 2013
 @@ -102,7 +102,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_str
  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)) {
 +if ((thelen  dlen-1) || (src[thelen] == '\0') {

Can't this be reduced to just

if (src[thelen] == '\0') {

?

Regards

RĂ¼diger



Re: svn commit: r1533169 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

2013-10-18 Thread Yann Ylavic
On Fri, Oct 18, 2013 at 1:11 PM, Ruediger Pluem rpl...@apache.org wrote:

 j...@apache.org wrote:
  +if ((thelen  dlen-1) || (src[thelen] == '\0') {

 Can't this be reduced to just

 if (src[thelen] == '\0') {

 ?


Not if src and dlen are zero?
IMHO the underflow (in the original code) should really be handled
explicitly.



 Regards



Re: svn commit: r1533169 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

2013-10-18 Thread Jim Jagielski
yeah, makes sense.

On Oct 18, 2013, at 7:11 AM, Ruediger Pluem rpl...@apache.org wrote:

 
 
 j...@apache.org wrote:
 Author: jim
 Date: Thu Oct 17 17:21:04 2013
 New Revision: 1533169
 
 URL: http://svn.apache.org/r1533169
 Log:
 from an idea by Yann Ylavic ylavic@gmail.com
 
 Modified:
httpd/httpd/trunk/modules/proxy/proxy_util.c
 
 Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
 URL: 
 http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1533169r1=1533168r2=1533169view=diff
 ==
 --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
 +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Thu Oct 17 17:21:04 2013
 @@ -102,7 +102,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_str
 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)) {
 +if ((thelen  dlen-1) || (src[thelen] == '\0') {
 
 Can't this be reduced to just
 
 if (src[thelen] == '\0') {
 
 ?
 
 Regards
 
 RĂ¼diger