Re: logic error in httpHdrRangeSpecParseCreate

From: Pierangelo Masarati <ando@dont-contact.us>
Date: Sat, 08 Sep 2007 10:19:19 +0200

Wenzhuo Zhang wrote:
> Hi, squid developers
>
> When reading squid-2.6-STABLE15 source code, I found a logical error in
> the "if" statement at "src/HttpHdrRange.c" line 96:
>
> if (!((p = strchr(field, '-')) || (p - field >= flen))) {
>
> If p is NULL, (p - field) is meaningless. If p is not NULL, the latter expression
> won't be evaluated.
>
> The statement should really be:
>
> if (!((p = strchr(field, '-')) && (p - field < flen))) {
>
> Attaching a diff which fixes the logical error.

I'm not a Squid developer, but your diagnosis sounds right. Just in
case, I think you should file a bug <http://www.squid-cache.org/bugs/>
so the fix, if confirmed, can be tracked.

Cheers, p.

Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
---------------------------------------
Office: +39 02 23998309
Mobile: +39 333 4963172
Email: pierangelo.masarati@sys-net.it
---------------------------------------
Received on Sat Sep 08 2007 - 02:22:04 MDT

This archive was generated by hypermail pre-2.1.9 : Mon Oct 01 2007 - 12:00:05 MDT