[master] 405d00759 vrt: Prevent potential null dereference

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Apr 30 08:51:05 UTC 2021


commit 405d0075920f8d63ab6f98a08380fc47ceca302c
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Apr 30 10:45:36 2021 +0200

    vrt: Prevent potential null dereference
    
    I'm leaving ctx alone because it is effectively checked.

diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index c86a70a0b..d60cc704c 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -655,6 +655,8 @@ VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
 VCL_BACKEND
 VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
 {
+
+	CHECK_OBJ_NOTNULL(vrt, VRT_BACKEND_MAGIC);
 	CHECK_OBJ_NOTNULL(vrt->endpoint, VRT_ENDPOINT_MAGIC);
 	return (VRT_new_backend_clustered(ctx, NULL, vrt));
 }


More information about the varnish-commit mailing list