patch to httpHeaderPack()

From: Adrian Chadd <adrian@dont-contact.us>
Date: Thu, 20 Dec 2007 21:31:52 +0900

Pawel has been seeing some assertions in httpHeaderPack(), and I'm guessing
its because i failed to handle the "last array entry may be NULL" option.

The patch to fix:

Index: HttpHeader.c
===================================================================
RCS file: /cvsroot/squid/squid/src/HttpHeader.c,v
retrieving revision 1.98
diff -u -r1.98 HttpHeader.c
--- HttpHeader.c 21 Nov 2007 12:59:22 -0000 1.98
+++ HttpHeader.c 20 Dec 2007 12:22:55 -0000
@@ -392,7 +392,8 @@
     pos = 0;
     while (dp < hdr->entries.count) {
        for (; dp < hdr->entries.count && hdr->entries.items[dp] == NULL; dp++);
- assert(dp < hdr->entries.count);
+ if (dp >= hdr->entries.count)
+ break;
        hdr->entries.items[pos] = hdr->entries.items[dp];
        if (dp != pos)
            hdr->entries.items[dp] = NULL;

I think thats right. I'll commit it tomorrow if anyone has any issues
and port it to 2.6/3.0.

Adrian

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
Received on Thu Dec 20 2007 - 05:24:52 MST

This archive was generated by hypermail pre-2.1.9 : Mon Dec 31 2007 - 12:00:03 MST