[openssh-commits] [openssh] 26/87: upstream: don't print stack garbage as a file's size in sftp `ls
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri Oct 30 20:21:03 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 9fccb0976b87343e1ae0bb310ea600b20440861a
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Oct 30 02:24:52 2026 +0000
upstream: don't print stack garbage as a file's size in sftp `ls
-lh` when the file is exactly 2^63 bytes.
Anthropic ANT-2026-JALC5MLW
OpenBSD-Commit-ID: 643f5c52389c112cd14e1b8d562949af7f5f1236
---
sftp-common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sftp-common.c b/sftp-common.c
index eb5cc2b82..0ad2caad0 100644
--- a/sftp-common.c
+++ b/sftp-common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-common.c,v 1.36 2026/02/11 17:05:32 dtucker Exp $ */
+/* $OpenBSD: sftp-common.c,v 1.37 2026/10/30 02:24:52 djm Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2001 Damien Miller. All rights reserved.
@@ -250,7 +250,9 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units,
ulen = MAXIMUM(strlen(user), 8);
glen = MAXIMUM(strlen(group), 8);
if (si_units) {
- fmt_scaled((long long)st->st_size, sbuf);
+ if ((unsigned long long)st->st_size > LLONG_MAX ||
+ fmt_scaled((long long)st->st_size, sbuf) != 0)
+ strlcpy(sbuf, "error", sizeof(sbuf));
snprintf(buf, sizeof buf, "%s %3s %-*s %-*s %8s %s %s",
mode, lc, ulen, user, glen, group,
sbuf, tbuf, name);
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list