[master] d2fd7b60e directors: Missing shard error handling

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Sun Oct 11 12:44:06 UTC 2020


commit d2fd7b60e80bc5fdea7c409f97090a6d55d925c0
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Sun Oct 11 14:42:20 2020 +0200

    directors: Missing shard error handling
    
    Spotted by Coverity.

diff --git a/lib/libvmod_directors/shard_cfg.c b/lib/libvmod_directors/shard_cfg.c
index a6e87fd5c..312e9c722 100644
--- a/lib/libvmod_directors/shard_cfg.c
+++ b/lib/libvmod_directors/shard_cfg.c
@@ -109,6 +109,10 @@ shard_change_get(VRT_CTX, struct sharddir * const shardd)
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 
 	task = VRT_priv_task(ctx, id);
+	if (task == NULL) {
+		shard_fail(ctx, shardd->name, "%s", "no priv_task");
+		return (NULL);
+	}
 
 	if (task->priv != NULL) {
 		CAST_OBJ_NOTNULL(change, task->priv, SHARD_CHANGE_MAGIC);


More information about the varnish-commit mailing list