[openssh-commits] [openssh] 15/87: upstream: clean up properly when stopping the progress meter,
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri Oct 30 20:20:52 AEDT 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 0630d978f1a1b5b96df817e077cd7ff804d9e95a
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Oct 30 01:26:02 2026 +0000
upstream: clean up properly when stopping the progress meter,
even if backgrounded and unable to output. Avoids reading free'd memory in a
subsequent progress meter invocation if the right (wrong) sequence of
backgrounding and forgroundings happened.
Anthropic ANT-2026-4MDN97DH
OpenBSD-Commit-ID: 40cc051b556697088851ec492bca2c00e1eac91e
---
progressmeter.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/progressmeter.c b/progressmeter.c
index 22f510a79..00340c6ec 100644
--- a/progressmeter.c
+++ b/progressmeter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: progressmeter.c,v 1.57 2026/03/29 01:08:13 djm Exp $ */
+/* $OpenBSD: progressmeter.c,v 1.58 2026/10/30 01:26:02 djm Exp $ */
/*
* Copyright (c) 2003 Nils Nordman. All rights reserved.
*
@@ -269,15 +269,21 @@ stop_progress_meter(void)
{
alarm(0);
- if (!can_output())
- return;
+ if (can_output()) {
+ /* Ensure we complete the progress */
+ if (cur_pos != end_pos)
+ refresh_progress_meter(1);
+ atomicio(vwrite, STDOUT_FILENO, "\n", 1);
+ }
- /* Ensure we complete the progress */
- if (cur_pos != end_pos)
- refresh_progress_meter(1);
-
- atomicio(vwrite, STDOUT_FILENO, "\n", 1);
+ /*
+ * Always forget the caller's file name and counter, even when we
+ * are not in the foreground and could not print; they don't outlive
+ * the transfer and must not be used by a later refresh.
+ */
file = NULL;
+ counter = NULL;
+ alarm_fired = 0;
}
static void
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list