Require layout prefix to be 5 characters, GitHub issue 5067 from

cglosner at gmail dot com.
This commit is contained in:
nicm
2026-05-07 09:21:05 +00:00
parent 962e565591
commit 496805476e
2 changed files with 4 additions and 3 deletions

View File

@@ -160,13 +160,14 @@ layout_parse(struct window *w, const char *layout, char **cause)
struct window_pane *wp;
u_int npanes, ncells, sx = 0, sy = 0;
u_short csum;
int n;
/* Check validity. */
if (sscanf(layout, "%hx,", &csum) != 1) {
if (sscanf(layout, "%hx,%n", &csum, &n) != 1 || n != 5) {
*cause = xstrdup("invalid layout");
return (-1);
}
layout += 5;
layout += n;
if (csum != layout_checksum(layout)) {
*cause = xstrdup("invalid layout");
return (-1);

View File

@@ -469,7 +469,7 @@ window_copy_init(struct window_mode_entry *wme,
struct screen *base = &wp->base;
struct screen_write_ctx ctx;
u_int i, cx, cy;
data = window_copy_common_init(wme);
data->backing = window_copy_clone_screen(base, &data->screen, &cx, &cy,
wme->swp != wme->wp);