[4.0] f2a0ace Correctly bail if there is insuficient storage for ESI data clone on IMS fetch.
Poul-Henning Kamp
phk at FreeBSD.org
Thu Mar 13 14:45:00 CET 2014
commit f2a0acec1566a38bdd41101773bf053cb6d103f3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Mar 13 08:55:14 2014 +0000
Correctly bail if there is insuficient storage for ESI data clone
on IMS fetch.
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 74724e0..cac3acb 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -579,12 +579,18 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
obj = bo->fetch_obj;
if (bo->ims_obj->esidata != NULL) {
- obj->esidata = STV_alloc(bo, bo->ims_obj->esidata->len);
- XXXAN(obj->esidata);
- xxxassert(obj->esidata->space >= bo->ims_obj->esidata->len);
- memcpy(obj->esidata->ptr, bo->ims_obj->esidata->ptr,
- bo->ims_obj->esidata->len);
- obj->esidata->len = bo->ims_obj->esidata->len;
+ sl = bo->ims_obj->esidata->len;
+ obj->esidata = STV_alloc(bo, sl);
+ if (obj->esidata == NULL || obj->esidata->space < sl) {
+ VSLb(bo->vsl, SLT_Error,
+ "No space for %zd bytes of ESI data", sl);
+ HSH_Fail(bo->fetch_objcore);
+ VBO_setstate(bo, BOS_FAILED);
+ HSH_Complete(obj->objcore);
+ return (F_STP_DONE);
+ }
+ memcpy(obj->esidata->ptr, bo->ims_obj->esidata->ptr, sl);
+ obj->esidata->len = sl;
}
obj->gziped = bo->ims_obj->gziped;
More information about the varnish-commit
mailing list