From: Amos Jeffries Date: Thu, 7 Apr 2016 13:10:28 +0000 (+1200) Subject: Bug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt X-Git-Tag: SQUID_4_0_9~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9974e82f0878c606d46ee795d2fc945ec66e8a1;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 7e5dd0fe19..c56cc67ecf 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);