From 557967c36ce4d80412405fb2ac20b599186689ba Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 7 Sep 2026 10:15:25 +0000 Subject: [PATCH 1/2] Do not silently make a session monitor if the target is unknown, GitHub issue 5575 from zzchun12826 at gmail dot com. --- monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index ff0c6e5ed..596e137a7 100644 --- a/monitor.c +++ b/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.7 2026/07/27 19:15:58 nicm Exp $ */ +/* $OpenBSD: monitor.c,v 1.8 2026/09/07 10:15:25 nicm Exp $ */ /* * Copyright (c) 2026 Nicholas Marriott @@ -614,8 +614,10 @@ monitor_parse(const char *value, char **name, enum monitor_type *type, int *id, *type = MONITOR_ALL_WINDOWS; else if (sscanf(what, "@%d", id) == 1 && *id >= 0) *type = MONITOR_WINDOW; - else + else if (*what == '\0') *type = MONITOR_SESSION; + else + goto fail; *name = xstrdup(copy); *format = xstrdup(split); From 00f3899aea035666fa9e7bd60bc7c2cf36c8e745 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 7 Sep 2026 12:05:12 +0000 Subject: [PATCH 2/2] Error on invalid relative targets, such as +foo or -0. GitHub issue 5576 from imcusg at gmail dot com. --- cmd-find.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmd-find.c b/cmd-find.c index b872d9eff..461d44a2f 100644 --- a/cmd-find.c +++ b/cmd-find.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-find.c,v 1.87 2026/07/17 12:42:51 nicm Exp $ */ +/* $OpenBSD: cmd-find.c,v 1.88 2026/09/07 12:05:12 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -389,9 +389,11 @@ cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window) /* Try as an offset. */ if (!exact && (window[0] == '+' || window[0] == '-')) { - if (window[1] != '\0') - n = strtonum(window + 1, 1, INT_MAX, NULL); - else + if (window[1] != '\0') { + n = strtonum(window + 1, 1, INT_MAX, &errstr); + if (errstr != NULL) + return (-1); + } else n = 1; s = fs->s; if (fs->flags & CMD_FIND_WINDOW_INDEX) { @@ -627,9 +629,11 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane) /* Try as an offset. */ if (pane[0] == '+' || pane[0] == '-') { - if (pane[1] != '\0') - n = strtonum(pane + 1, 1, INT_MAX, NULL); - else + if (pane[1] != '\0') { + n = strtonum(pane + 1, 1, INT_MAX, &errstr); + if (errstr != NULL) + return (-1); + } else n = 1; wp = fs->w->active; if (pane[0] == '+')