From: Ian Jackson Date: Sun, 6 Oct 2019 22:34:33 +0000 (+0100) Subject: conffile: find_cl_if: fix fail_if_invalid==False X-Git-Tag: v0.6.0~220 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=commitdiff_plain;h=dacaea330de26ca07de32f6b9cf8eecde1eb99e2;ds=sidebyside conffile: find_cl_if: fix fail_if_invalid==False If the key was not found, this would segfault, so passing False didn't work properly. Currently nothing does, so this bug is latent. Signed-off-by: Ian Jackson --- diff --git a/conffile.c b/conffile.c index c03c1d8..e6cf48f 100644 --- a/conffile.c +++ b/conffile.c @@ -661,6 +661,7 @@ void *find_cl_if(dict_t *dict, cstring_t name, uint32_t type, closure_t *cl; i = dict_find_item(dict,name,fail_if_invalid,desc,loc); + if (!i) return NULL; if (i->type!=t_closure) { if (!fail_if_invalid) return NULL; cfgfatal(loc,desc,"\"%s\" must be a closure\n",name);