]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Ignore Range headers with unidentifiable byte-range values
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 27 Aug 2014 14:40:59 +0000 (08:40 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 27 Aug 2014 14:40:59 +0000 (08:40 -0600)
If squid is unable to determine the byte value for ranges, treat the
header as invalid.

src/HttpHdrRange.cc

index 32a67a0a23ac36a38917658abb99c3c7593a78fa..ea8ffab62c8aee196a9eabadf174c817cd155c76 100644 (file)
@@ -93,7 +93,7 @@ HttpHdrRangeSpec::parseInit(const char *field, int flen)
 
     /* is it a suffix-byte-range-spec ? */
     if (*field == '-') {
-        if (!httpHeaderParseOffset(field + 1, &length))
+        if (!httpHeaderParseOffset(field + 1, &length) || !known_spec(length))
             return false;
     } else
         /* must have a '-' somewhere in _this_ field */
@@ -101,7 +101,7 @@ HttpHdrRangeSpec::parseInit(const char *field, int flen)
             debugs(64, 2, "invalid (missing '-') range-spec near: '" << field << "'");
             return false;
         } else {
-            if (!httpHeaderParseOffset(field, &offset))
+            if (!httpHeaderParseOffset(field, &offset) || !known_spec(offset))
                 return false;
 
             p++;
@@ -110,7 +110,7 @@ HttpHdrRangeSpec::parseInit(const char *field, int flen)
             if (p - field < flen) {
                 int64_t last_pos;
 
-                if (!httpHeaderParseOffset(p, &last_pos))
+                if (!httpHeaderParseOffset(p, &last_pos) || !known_spec(last_pos))
                     return false;
 
                 // RFC 2616 s14.35.1 MUST: last-byte-pos >= first-byte-pos