]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed bug in CharacterSet::addRange()
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 11 Jun 2014 10:31:56 +0000 (12:31 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 11 Jun 2014 10:31:56 +0000 (12:31 +0200)
src/base/CharacterSet.cc

index 95d7045d3f77190151efe7c3e35feb03fa5a6a03..0955ebd4e283581216222b3910e6b005e5fa45e7 100644 (file)
@@ -34,10 +34,13 @@ CharacterSet::add(const unsigned char c)
 CharacterSet &
 CharacterSet::addRange(unsigned char low, unsigned char high)
 {
-    while (low <= high) {
+    //manual loop splitting is needed to cover case where high is 255
+    // otherwise low will wrap, resulting in infinite loop
+    while (low < high) {
         chars_[static_cast<uint8_t>(low)] = 1;
         ++low;
     }
+    chars_[static_cast<uint8_t>(high)] = 1;
     return *this;
 }