[6.0] 0ecefa8f5 vmod_h2: VRT_fail if called outside of client context
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 18 16:40:08 UTC 2023
commit 0ecefa8f55adcac4b7455dc8b1b8c823d2fc122a
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date: Wed Oct 18 15:32:32 2023 +0200
vmod_h2: VRT_fail if called outside of client context
diff --git a/lib/libvmod_h2/vmod_h2.c b/lib/libvmod_h2/vmod_h2.c
index 2153e979e..009aafc6f 100644
--- a/lib/libvmod_h2/vmod_h2.c
+++ b/lib/libvmod_h2/vmod_h2.c
@@ -43,7 +43,12 @@ h2get(VRT_CTX)
uintptr_t *up;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); // $Restrict client
+ if (ctx->req == NULL) {
+ VRT_fail(ctx,
+ "vmod_h2 can only be called from client-side VCL.");
+ return (NULL);
+ }
+ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
if (ctx->req->transport != &H2_transport)
return (NULL);
AZ(SES_Get_proto_priv(ctx->req->sp, &up));
More information about the varnish-commit
mailing list