[master] 7a9fc904f Handle ObjGetAttr failure

Nils Goroll nils.goroll at uplex.de
Thu Aug 22 15:48:07 UTC 2024


commit 7a9fc904fa89b5cc6c9b21ae8cb057852641b8de
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Aug 22 16:51:22 2024 +0200

    Handle ObjGetAttr failure
    
    seen with custom storage engine error injection.

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index ed97a0110..45f66defc 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -136,6 +136,7 @@ Resp_Setup_Deliver(struct req *req)
 {
 	struct http *h;
 	struct objcore *oc;
+	const void *hdrs;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	oc = req->objcore;
@@ -145,7 +146,8 @@ Resp_Setup_Deliver(struct req *req)
 
 	HTTP_Setup(h, req->ws, req->vsl, SLT_RespMethod);
 
-	if (HTTP_Decode(h, ObjGetAttr(req->wrk, oc, OA_HEADERS, NULL)))
+	hdrs = ObjGetAttr(req->wrk, oc, OA_HEADERS, NULL);
+	if (hdrs == NULL || HTTP_Decode(h, hdrs))
 		return (-1);
 
 	http_ForceField(h, HTTP_HDR_PROTO, "HTTP/1.1");


More information about the varnish-commit mailing list