From 1d8a896bab089eecdd9b17e80df41976e7c2fba4 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 3 Dec 2009 11:27:33 +1300 Subject: [PATCH] Bug 2830: clarify where NULL byte is in headers. Debug printing used to naturally stop string output at the null byte. This should show the first segment of headers up to the NULL and the segment of headers after it. So that its clear to admin that there are more headers _after_ the portion that used to be logged. --- src/HttpHeader.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index e0fba7b686..f6a91b9de1 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -514,9 +514,10 @@ HttpHeader::parse(const char *header_start, const char *header_end) debugs(55, 7, "parsing hdr: (" << this << ")" << std::endl << getStringPrefix(header_start, header_end)); HttpHeaderStats[owner].parsedCount++; - if (memchr(header_start, '\0', header_end - header_start)) { + char *nulpos; + if (nulpos = memchr(header_start, '\0', header_end - header_start)) { debugs(55, 1, "WARNING: HTTP header contains NULL characters {" << - getStringPrefix(header_start, header_end) << "}"); + getStringPrefix(header_start, nulpos) << "}\nNULL\n{" << getStringPrefix(nulpos+1, header_end)); goto reset; } -- 2.47.2