From: Amos Jeffries Date: Mon, 11 Apr 2016 13:11:30 +0000 (+1200) Subject: Bug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt X-Git-Tag: SQUID_3_5_17~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=338f33031addcec606798517c681d7da73ae927a;p=thirdparty%2Fsquid.git Bug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt --- diff --git a/src/StoreMetaVary.cc b/src/StoreMetaVary.cc index bd8423ff55..7f86be7421 100644 --- a/src/StoreMetaVary.cc +++ b/src/StoreMetaVary.cc @@ -22,6 +22,9 @@ StoreMetaVary::checkConsistency(StoreEntry *e) const /* XXX separate this mutator from the query */ /* Assume the object is OK.. remember the vary request headers */ e->mem_obj->vary_headers.assign(static_cast(value), length); + /* entries created before SBuf vary handling may include string terminator */ + static const SBuf nul("\0", 1); + e->mem_obj->vary_headers.trim(nul); return true; } diff --git a/src/store_swapmeta.cc b/src/store_swapmeta.cc index eb33e69319..2d2b68440d 100644 --- a/src/store_swapmeta.cc +++ b/src/store_swapmeta.cc @@ -89,9 +89,7 @@ storeSwapMetaBuild(StoreEntry * e) SBuf vary(e->mem_obj->vary_headers); if (!vary.isEmpty()) { - // TODO: do we still need +1 here? StoreMetaVary::checkConsistency - // no longer relies on nul-termination, but other things might. - t = StoreMeta::Factory(STORE_META_VARY_HEADERS, vary.length() + 1, vary.c_str()); + t = StoreMeta::Factory(STORE_META_VARY_HEADERS, vary.length(), vary.c_str()); if (!t) { storeSwapTLVFree(TLV);