summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-05-22 18:58:31 +0000
committernicm <nicm@openbsd.org>2019-05-22 18:58:31 +0000
commitd7b9896b9a87ae8a43e8d3e0011e821cc9b3ae5e (patch)
treed9062a30a0e990b40c571670c6d85eb75227b466
parentA wscons device may only be opened in read/write mode once. However, (diff)
downloadwireguard-openbsd-d7b9896b9a87ae8a43e8d3e0011e821cc9b3ae5e.tar.xz
wireguard-openbsd-d7b9896b9a87ae8a43e8d3e0011e821cc9b3ae5e.zip
Fix crash if window doesn't exist, GitHub issue 1751.
-rw-r--r--usr.bin/tmux/cmd-show-options.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c
index 764ea399254..6a316dd2134 100644
--- a/usr.bin/tmux/cmd-show-options.c
+++ b/usr.bin/tmux/cmd-show-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-options.c,v 1.51 2019/05/12 18:18:30 nicm Exp $ */
+/* $OpenBSD: cmd-show-options.c,v 1.52 2019/05/22 18:58:31 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -91,7 +91,14 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item)
window = (self->entry == &cmd_show_window_options_entry);
if (args->argc == 0) {
- options_scope_from_flags(args, window, fs, &oo, &cause);
+ scope = options_scope_from_flags(args, window, fs, &oo, &cause);
+ if (scope == OPTIONS_TABLE_NONE) {
+ if (args_has(args, 'q'))
+ return (CMD_RETURN_NORMAL);
+ cmdq_error(item, "%s", cause);
+ free(cause);
+ return (CMD_RETURN_ERROR);
+ }
return (cmd_show_options_all(self, item, oo));
}
argument = format_single(item, args->argv[0], c, s, wl, NULL);