summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/format-draw.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-02-22 11:07:26 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-02-22 11:07:26 +0000
commit36e5c39a280f6af578d8db385438e7d0990c3204 (patch)
tree7491614c9e611e8438a82fb07b8a5001ff56fab1 /usr.bin/tmux/format-draw.c
parent36850f322454c29057972729cb9eb590473ecd18 (diff)
Initialize copy_width before adjusting it, GitHub issue 3079.
Diffstat (limited to 'usr.bin/tmux/format-draw.c')
-rw-r--r--usr.bin/tmux/format-draw.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/tmux/format-draw.c b/usr.bin/tmux/format-draw.c
index a80e0893929..b36daa17ecd 100644
--- a/usr.bin/tmux/format-draw.c
+++ b/usr.bin/tmux/format-draw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format-draw.c,v 1.25 2021/10/26 12:22:23 nicm Exp $ */
+/* $OpenBSD: format-draw.c,v 1.26 2022/02/22 11:07:25 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1154,13 +1154,13 @@ format_trim_right(const char *expanded, u_int limit)
while (*cp != '\0') {
if (*cp == '#') {
end = format_leading_hashes(cp, &n, &leading_width);
+ copy_width = leading_width;
if (width <= skip) {
- if (skip - width >= leading_width)
+ if (skip - width >= copy_width)
copy_width = 0;
else
copy_width -= (skip - width);
- } else
- copy_width = leading_width;
+ }
if (copy_width != 0) {
if (n == 1)
*out++ = '#';