From: NeilBrown Date: Thu, 27 Jul 2023 11:32:07 +0000 (+1000) Subject: Avoid null pointer deref when ccache used. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=7b87033c8e4e915931a852bffa6b6dc90fbd10c5;p=edlib.git Avoid null pointer deref when ccache used. This can make ->home NULL which times_up() no trips over. I should probably discard this ccache stuff. Signed-off-by: NeilBrown --- diff --git a/DOC/TODO.md b/DOC/TODO.md index 37a2b51c..ddb82838 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -91,6 +91,7 @@ Requirements for a v1.0 release Core features ------------- +- [ ] Discard ccache ?? - [ ] Ensure all panes that should use "Free" properly, and find some what to encourage its use. - [ ] Add optional unit-test interface for modules. This should be diff --git a/core-pane.h b/core-pane.h index 1e146047..24ce3ec6 100644 --- a/core-pane.h +++ b/core-pane.h @@ -121,8 +121,10 @@ static inline int do_call_val(enum target_type type, struct pane *home, /* fall-through */ case TYPE_focus: if (ccache) { - ci.home = ccache->home; - ci.comm = ccache->comm; + if ((void*)ccache->home) + ci.home = ccache->home; + if ((void*)ccache->comm) + ci.comm = ccache->comm; } ret = key_handle(&ci); break;