From f45ad91f7ac3fe314dd82e1701a4a5f2ad5e0d2f Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 22 Feb 2022 11:07:25 +0000 Subject: [PATCH] Initialize copy_width before adjusting it, GitHub issue 3079. --- usr.bin/tmux/format-draw.c | 8 ++++---- 1 file 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 @@ -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++ = '#'; -- 2.20.1