From c8b9eb1c7300ce4d62b5c466de901b8797bfdb4d Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 10 Apr 2009 20:09:58 +1200 Subject: [PATCH] Bug 1232: cache_dir parameter limited to only 63 entries. 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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 04a085ff54..6f160b9fcc 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1483,8 +1483,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(swap->swapDirs[i].getRaw())->path) - ) == 0) { + if ((strcasecmp(path_str, dynamic_cast(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 @@ -1509,7 +1508,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); -- 2.47.2