From: Amos Jeffries Date: Sun, 8 May 2016 12:43:33 +0000 (+1200) Subject: Bug 4515: regression after CVE-2016-4554 patch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acf894b0aa659e2c17f4b9d26afc786aae06072f;p=thirdparty%2Fsquid.git Bug 4515: regression after CVE-2016-4554 patch --- diff --git a/src/mime_header.cc b/src/mime_header.cc index d5f0ef110a..e5b2a7a7ad 100644 --- a/src/mime_header.cc +++ b/src/mime_header.cc @@ -66,10 +66,13 @@ mime_get_header_field(const char *mime, const char *name, const char *prefix) debugs(25, 5, "mime_get_header: looking for '" << name << "'"); - for (p = mime; *p; p += strcspn(p, "\n\r")) { - if (strcmp(p, "\r\n\r\n") == 0 || strcmp(p, "\n\n") == 0) + for (p = mime; *p; p += strcspn(p, "\n")) { + if (strcmp(p, "\n\r\n") == 0 || strcmp(p, "\n\n") == 0) return NULL; + if (*p == '\n') + ++p; + if (strncasecmp(p, name, namelen)) continue;