diff --git a/CHANGES b/CHANGES index 88baf7f42..62a7f8fc5 100644 --- a/CHANGES +++ b/CHANGES @@ -130,6 +130,8 @@ CHANGES FROM 3.7c TO 3.8 * Add capture-pane -I to include the time each line entered history. +* Various memory leak fixes from Heon Jeong. + * Add a default C-b T binding to change the current pane title. * Menus now belong to the window, so appear on all clients. diff --git a/cmd-split-window.c b/cmd-split-window.c index 3ddc33c22..641792e2c 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-split-window.c,v 1.150 2026/08/20 09:19:24 nicm Exp $ */ +/* $OpenBSD: cmd-split-window.c,v 1.151 2026/09/10 11:02:18 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott diff --git a/layout-custom.c b/layout-custom.c index 7f6da285c..48b12a967 100644 --- a/layout-custom.c +++ b/layout-custom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-custom.c,v 1.40 2026/09/09 07:03:39 nicm Exp $ */ +/* $OpenBSD: layout-custom.c,v 1.41 2026/09/09 09:01:19 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott @@ -28,8 +28,8 @@ #include "tmux.h" /* - * Layouts can be represented as strings in a JSON format (v2). The legacy - * format (v1) will be removed in the future and should no longer be used. + * Layouts can be represented as strings in a JSON format (v2). The version 1 + * format will be removed in the future and should no longer be used. * * The current (v2) format is JSON. The top level has two keys: * "V": version number, currently 2 @@ -57,6 +57,9 @@ * "z": z-index, if a floating pane */ +/* Maximum nesting depth for version 1 layouts. */ +#define LAYOUT_V1_MAX_DEPTH 1000 + /* Layout string. */ struct layout_string { char *dat; @@ -362,7 +365,7 @@ layout_append_v2(struct layout_cell *lc, struct layout_string *ls) return (0); } -/* Append information for a single cell in the legacy (v1) format. */ +/* Append information for a single cell in the version 1 format. */ static int layout_append_v1(struct layout_cell *lc, struct layout_string *ls) { @@ -778,7 +781,7 @@ layout_assign(struct window *w, struct layout_parse_ctx *pctx) layout_assign_fallback(w, w->layout_root); } -/* Construct a cell from the legacy (v1) format. */ +/* Construct a cell from the version 1 format. */ static struct layout_cell * layout_construct_cell(struct layout_cell *lcparent, const char **layout) { @@ -827,12 +830,15 @@ layout_construct_cell(struct layout_cell *lcparent, const char **layout) return (lc); } -/* Construct a layout from the legacy (v1) format. */ +/* Construct a layout from the version 1 format. */ static struct layout_cell * -layout_construct_v1(struct layout_cell *lcparent, const char **layout) +layout_construct_v1(struct layout_cell *lcparent, const char **layout, u_int depth) { struct layout_cell *lc, *lcchild; + if (depth > LAYOUT_V1_MAX_DEPTH) + return (NULL); + lc = layout_construct_cell(lcparent, layout); if (lc == NULL) return (NULL); @@ -855,7 +861,7 @@ layout_construct_v1(struct layout_cell *lcparent, const char **layout) do { (*layout)++; - lcchild = layout_construct_v1(lc, layout); + lcchild = layout_construct_v1(lc, layout, depth + 1); if (lcchild == NULL) goto fail; TAILQ_INSERT_TAIL(&lc->cells, lcchild, entry); @@ -1068,7 +1074,8 @@ layout_construct(const char *input, struct layout_parse_ctx *pctx) *pctx->cause = xstrdup("invalid layout checksum"); return (-1); } - if ((pctx->root = layout_construct_v1(NULL, &input)) == NULL) { + pctx->root = layout_construct_v1(NULL, &input, 0); + if (pctx->root == NULL) { *pctx->cause = xstrdup("invalid layout"); return (-1); } diff --git a/options-table.c b/options-table.c index 7a2575b02..4951c6325 100644 --- a/options-table.c +++ b/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.244 2026/09/01 12:49:49 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.245 2026/09/10 11:02:18 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott diff --git a/regress/control-client-sanity.sh b/regress/control-client-sanity.sh index 32695e7c0..b85589de6 100644 --- a/regress/control-client-sanity.sh +++ b/regress/control-client-sanity.sh @@ -30,8 +30,11 @@ killw EOF sleep 1 $TMUX has || exit 1 -$TMUX lsp -aF '#{pane_id} #{window_layout}' >$TMP || exit 1 -cat <$TMP || exit 1 +cat <