=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-set-option.c,v retrieving revision 1.119 retrieving revision 1.120 diff -c -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 **** ! /* $OpenBSD: cmd-set-option.c,v 1.119 2017/12/22 10:18:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-set-option.c,v 1.120 2018/10/18 08:38:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 18,23 **** --- 18,24 ---- #include + #include #include #include *************** *** 260,266 **** } if (strcmp(name, "pane-border-status") == 0) { RB_FOREACH(w, windows, &windows) ! layout_fix_panes(w, w->sx, w->sy); } RB_FOREACH(s, sessions, &sessions) status_update_saved(s); --- 261,267 ---- } if (strcmp(name, "pane-border-status") == 0) { RB_FOREACH(w, windows, &windows) ! layout_fix_panes(w); } RB_FOREACH(s, sessions, &sessions) status_update_saved(s); *************** *** 297,303 **** int append = args_has(args, 'a'); struct options_entry *o; long long number; ! const char *errstr; key_code key; oe = options_table_entry(parent); --- 298,305 ---- int append = args_has(args, 'a'); struct options_entry *o; long long number; ! const char *errstr, *new; ! char *old; key_code key; oe = options_table_entry(parent); *************** *** 310,316 **** --- 312,327 ---- 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);