[openssh-commits] [openssh] branch master updated: sync glob.c with OpenBSD
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Nov 26 04:03:21 AEDT 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
The following commit(s) were added to refs/heads/master by this push:
new 70dd584ca sync glob.c with OpenBSD
70dd584ca is described below
commit 70dd584ca62215e8405684c94234389d572d6bb0
Author: Damien Miller <djm at mindrot.org>
AuthorDate: Thu Nov 26 04:03:06 2026 +1100
sync glob.c with OpenBSD
revision 1.52
date: 2026/11/25 15:20:50; author: millert; state: Exp; lines: +1 -5; commitid: GWcHURWphfAPy4a8;
glob.c: Fix potential out-of-bounds write for GLOB_NOSPACE error
When the GLOB_LIMIT option is specified, glob returns the GLOB_NOSPACE
error when hitting either the GLOB_LIMIT_STAT or GLOB_LIMIT_READDIR
limits. Before returning the error, glob stored the path separator
and NUL terminating the result before returning. If we are at the
very end of the path buffer, it is possible for this to write past
the end of the buffer. Change this to just return GLOB_NOSPACE
when the limit is reached without writing the path separator or NUL
terminator.
OK djm@
---
openbsd-compat/glob.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c
index c832224d2..9e55af1e2 100644
--- a/openbsd-compat/glob.c
+++ b/openbsd-compat/glob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glob.c,v 1.51 2026/10/24 18:08:57 millert Exp $ */
+/* $OpenBSD: glob.c,v 1.52 2026/11/25 15:20:50 millert Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -656,8 +656,6 @@ glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
if ((pglob->gl_flags & GLOB_LIMIT) &&
limitp->glim_stat++ >= GLOB_LIMIT_STAT) {
errno = 0;
- *pathend++ = SEP;
- *pathend = EOS;
return(GLOB_NOSPACE);
}
if (g_lstat(pathbuf, &sb, pglob))
@@ -754,8 +752,6 @@ glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
if ((pglob->gl_flags & GLOB_LIMIT) &&
limitp->glim_readdir++ >= GLOB_LIMIT_READDIR) {
errno = 0;
- *pathend++ = SEP;
- *pathend = EOS;
err = GLOB_NOSPACE;
break;
}
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list