From 36d904011a0620284ad3a51639a090024f2575fb Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 2 Aug 2022 08:57:01 +0000 Subject: [PATCH 1/2] -u is no longer equivalent to -TUTF-8 so don't say it is. --- tmux.1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/tmux.1 b/tmux.1 index 1fc2d061..a1298fe0 100644 --- a/tmux.1 +++ b/tmux.1 @@ -214,8 +214,6 @@ that is set does not contain .Qq UTF-8 or .Qq UTF8 . -This is equivalent to -.Fl T Ar UTF-8 . .It Fl T Ar features Set terminal features for the client. This is a comma-separated list of features. From 33c59100aeb49894550b97cce268f46032f4c8d6 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 2 Aug 2022 09:23:34 +0000 Subject: [PATCH 2/2] Fix validation of missing percentage arguments. --- arguments.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arguments.c b/arguments.c index 485af2be..b08582ee 100644 --- a/arguments.c +++ b/arguments.c @@ -895,6 +895,10 @@ args_percentage(struct args *args, u_char flag, long long minval, *cause = xstrdup("missing"); return (0); } + if (TAILQ_EMPTY(&entry->values)) { + *cause = xstrdup("empty"); + return (0); + } value = TAILQ_LAST(&entry->values, args_values)->string; return (args_string_percentage(value, minval, maxval, curval, cause)); } @@ -909,6 +913,10 @@ args_string_percentage(const char *value, long long minval, long long maxval, size_t valuelen = strlen(value); char *copy; + if (valuelen == 0) { + *cause = xstrdup("empty"); + return (0); + } if (value[valuelen - 1] == '%') { copy = xstrdup(value); copy[valuelen - 1] = '\0'; @@ -955,6 +963,10 @@ args_percentage_and_expand(struct args *args, u_char flag, long long minval, *cause = xstrdup("missing"); return (0); } + if (TAILQ_EMPTY(&entry->values)) { + *cause = xstrdup("empty"); + return (0); + } value = TAILQ_LAST(&entry->values, args_values)->string; return (args_string_percentage_and_expand(value, minval, maxval, curval, item, cause));