File 12490.patch of Package squid
---------------------
PatchSet 12490
Date: 2009/06/25 22:54:13
Author: hno
Branch: SQUID_2_7
Tag: (none)
Log:
Author: Mark Nottingham <mnot@pobox.com>
MFC: Bug #2515: Final chunk parsing errors on FreeBSD6+
Because strtoll has different behaviour (actually, POSIX-compliant, AFAICT, but whatever)
on FreeBSD6+, it's not possible to count on strtoll not setting errno to EINVALID when parsing
"/r/n".
This patch checks to see if it's an empty line before checking errno, avoiding this problem.
Members:
src/http.c:1.439.2.7->1.439.2.8
Index: squid/src/http.c
===================================================================
RCS file: /cvsroot/squid/squid/src/http.c,v
retrieving revision 1.439.2.7
retrieving revision 1.439.2.8
diff -u -r1.439.2.7 -r1.439.2.8
--- squid/src/http.c 25 Sep 2008 02:33:37 -0000 1.439.2.7
+++ squid/src/http.c 25 Jun 2009 22:54:13 -0000 1.439.2.8
@@ -1,6 +1,6 @@
/*
- * $Id: http.c,v 1.439.2.7 2008/09/25 02:33:37 hno Exp $
+ * $Id: http.c,v 1.439.2.8 2009/06/25 22:54:13 hno Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
@@ -699,10 +699,10 @@
debug(11, 3) ("Chunk header '%s'\n", strBuf(httpState->chunkhdr));
errno = 0;
httpState->chunk_size = strto_off_t(strBuf(httpState->chunkhdr), &end, 16);
- if (errno)
- badchunk = 1;
- else if (end == strBuf(httpState->chunkhdr))
+ if (end == strBuf(httpState->chunkhdr))
emptychunk = 1;
+ else if (errno)
+ badchunk = 1;
while (end && (*end == '\r' || *end == ' ' || *end == '\t'))
end++;
if (httpState->chunk_size < 0 || badchunk || !end || (*end != '\n' && *end != ';')) {