vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 382a3e8512520e2c60e79ba63ba7038a43925817 parent 0f2d7d7589bf5ca9e51f627ecb6f63a4d0feac7b Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 21 Mar 2017 08:21:49 +0100 vis: reject invalid option names This should fix the ressource leak as found by CID 142510. Diffstat:
| M | vis-cmds.c | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/vis-cmds.c b/vis-cmds.c @@ -78,6 +78,10 @@ static void option_free(OptionDef *opt) { bool vis_option_register(Vis *vis, const char *names[], enum VisOption flags, VisOptionFunction *func, void *context, const char *help) { + + if (!names || !names[0]) + return false; + for (const char **name = names; *name; name++) { if (map_get(vis->options, *name)) return false;