[openssh-commits] [openssh] 09/14: upstream: clamp amount of auth_debug data that we'll buffer for
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Nov 26 10:20:54 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 a342b8bded242399973662da2d5093b206a3bd3a
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Wed Nov 25 21:16:32 2026 +0000
upstream: clamp amount of auth_debug data that we'll buffer for
the user to 64Kb, which ought to be enough for everyone.
Anthropic ANT-2026-O6FX9NNV
OpenBSD-Commit-ID: 1278008b5fc3fb279efc81334cf127e62649da02
---
auth.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/auth.c b/auth.c
index d48815ba4..c65b3094e 100644
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth.c,v 1.166 2026/10/30 04:39:16 djm Exp $ */
+/* $OpenBSD: auth.c,v 1.167 2026/11/25 21:16:32 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -83,6 +83,7 @@ extern struct sshauthopt *auth_opts;
/* Debugging messages */
static struct sshbuf *auth_debug;
+#define AUTH_DEBUG_MAX (64 * 1024) /* max bytes of messages to retain */
/*
* Check if the user is allowed to log in via ssh. If user is listed
@@ -597,9 +598,14 @@ auth_debug_add(const char *fmt,...)
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
debug3("%s", buf);
- if (auth_debug != NULL)
- if ((r = sshbuf_put_cstring(auth_debug, buf)) != 0)
- fatal_fr(r, "sshbuf_put_cstring");
+ /*
+ * Messages accumulate until authentication succeeds and many
+ * originate from user-controlled files, so bound their total size.
+ */
+ if (auth_debug == NULL || sshbuf_len(auth_debug) >= AUTH_DEBUG_MAX)
+ return;
+ if ((r = sshbuf_put_cstring(auth_debug, buf)) != 0)
+ fatal_fr(r, "sshbuf_put_cstring");
}
void
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list