Even though we skip empty entries separated with commas when we're looking at each item, an input such as:
choose-list -l ,,,,,, would still mean we go on to display a blank line, resulting in a segfault as there's no data associated with that entry. --- cmd-choose-list.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd-choose-list.c b/cmd-choose-list.c index 15c644e..ef05de5 100644 --- a/cmd-choose-list.c +++ b/cmd-choose-list.c @@ -75,7 +75,7 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_ctx *ctx) template = xstrdup(CMD_CHOOSE_LIST_DEFAULT_TEMPLATE); copy = list = xstrdup(list1); - idx = 0; + idx = -1; while ((item = strsep(&list, ",")) != NULL) { if (*item == '\0') /* no empty entries */ @@ -86,8 +86,17 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_ctx *ctx) } free(copy); - window_choose_ready(wl->window->active, 0, cmd_choose_list_callback, - cmd_choose_list_free); + /* Even though we skip empty entries separated by commas, an entirely + * empty list means we do nothing. + */ + if ((int)idx < 0) { + free(template); + window_pane_reset_mode(wl->window->active); + return (CMD_RETURN_ERROR); + } + + window_choose_ready(wl->window->active, 0, + cmd_choose_list_callback, cmd_choose_list_free); free(template); -- 1.7.11.4 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users