logic error in httpHdrRangeSpecParseCreate

From: Wenzhuo Zhang <wenzhuo@dont-contact.us>
Date: Thu, 06 Sep 2007 17:06:15 +0800

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.

Wenzhuo

Received on Fri Sep 07 2007 - 19:31:45 MDT

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