]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 1232: cache_dir parameter limited to only 63 entries.
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 11 Mar 2009 08:56:13 +0000 (21:56 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 11 Mar 2009 08:56:13 +0000 (21:56 +1300)
This alters the squid.conf parsing limit on cache_dir entries
into a softer configuration warning. It was a core dump.

Also opens the final bit of the 7-bit signed range for use
which makes the limit 64 cache dirs in total.

src/cache_cf.cc

index b19bf1b10ff2b262e4edddfedcd7e44c40ea4803..89bf87e7167f5450ac271ba357e289f4d2888c62 100644 (file)
@@ -1490,8 +1490,7 @@ parse_cachedir(SquidConfig::_cacheSwap * swap)
     for (i = 0; i < swap->n_configured; i++) {
         assert (swap->swapDirs[i].getRaw());
 
-        if ((strcasecmp(path_str, dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw())->path)
-            ) == 0) {
+        if ((strcasecmp(path_str, dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw())->path)) == 0) {
             /* this is specific to on-fs Stores. The right
              * way to handle this is probably to have a mapping
              * from paths to stores, and have on-fs stores
@@ -1516,7 +1515,13 @@ parse_cachedir(SquidConfig::_cacheSwap * swap)
     }
 
     /* new cache_dir */
-    assert(swap->n_configured < 63);   /* 7 bits, signed */
+    if(swap->n_configured > 63) {
+        /* 7 bits, signed */
+        debugs(3, DBG_CRITICAL, "WARNING: There is a fixed maximum of 63 cache_dir entries Squid can handle.");
+        debugs(3, DBG_CRITICAL, "WARNING: '" << path_str << "' is one to many.");
+        self_destruct();
+        return;
+    }
 
     allocate_new_swapdir(swap);