=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-set-option.c,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- src/usr.bin/tmux/cmd-set-option.c 2017/12/22 10:18:51 1.119 +++ src/usr.bin/tmux/cmd-set-option.c 2018/10/18 08:38:01 1.120 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.119 2017/12/22 10:18:51 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.120 2018/10/18 08:38:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -18,6 +18,7 @@ #include +#include #include #include @@ -260,7 +261,7 @@ } if (strcmp(name, "pane-border-status") == 0) { RB_FOREACH(w, windows, &windows) - layout_fix_panes(w, w->sx, w->sy); + layout_fix_panes(w); } RB_FOREACH(s, sessions, &sessions) status_update_saved(s); @@ -297,7 +298,8 @@ int append = args_has(args, 'a'); struct options_entry *o; long long number; - const char *errstr; + const char *errstr, *new; + char *old; key_code key; oe = options_table_entry(parent); @@ -310,7 +312,16 @@ switch (oe->type) { case OPTIONS_TABLE_STRING: + old = xstrdup(options_get_string(oo, oe->name)); options_set_string(oo, oe->name, append, "%s", value); + new = options_get_string(oo, oe->name); + if (oe->pattern != NULL && fnmatch(oe->pattern, new, 0) != 0) { + options_set_string(oo, oe->name, 0, "%s", old); + free(old); + cmdq_error(item, "value is invalid: %s", value); + return (-1); + } + free(old); return (0); case OPTIONS_TABLE_NUMBER: number = strtonum(value, oe->minimum, oe->maximum, &errstr);