summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2012-01-20 07:09:42 +0000
committertedu <tedu@openbsd.org>2012-01-20 07:09:42 +0000
commit8e6706f3fc64adbfb0cc5dafdc52fdb5be299526 (patch)
tree5cf9109a755002ed688433762252118bf81b54b1
parentDo not log the password at LOG_INFO, but at LOG_DEBUG instead. (diff)
downloadwireguard-openbsd-8e6706f3fc64adbfb0cc5dafdc52fdb5be299526.tar.xz
wireguard-openbsd-8e6706f3fc64adbfb0cc5dafdc52fdb5be299526.zip
the glob stat limit is way too low. bump to 2048.
while here, failed stats should count against the limit too. ok deraadt sthen stsp
-rw-r--r--lib/libc/gen/glob.36
-rw-r--r--lib/libc/gen/glob.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/gen/glob.3 b/lib/libc/gen/glob.3
index b3f066ed300..ae75b98f3fd 100644
--- a/lib/libc/gen/glob.3
+++ b/lib/libc/gen/glob.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: glob.3,v 1.29 2010/10/08 21:48:42 nicm Exp $
+.\" $OpenBSD: glob.3,v 1.30 2012/01/20 07:09:42 tedu Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 8 2010 $
+.Dd $Mdocdate: January 20 2012 $
.Dt GLOB 3
.Os
.Sh NAME
@@ -269,7 +269,7 @@ Limit the amount of memory used to store matched strings to
.Li 64K ,
the number of
.Xr stat 2
-calls to 128, and the number of
+calls to 2048, and the number of
.Xr readdir 3
calls to 16K.
This option should be set for programs that can be coerced to a denial of
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index fcc0c4120d9..397b60d2904 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glob.c,v 1.38 2011/09/22 06:27:29 djm Exp $ */
+/* $OpenBSD: glob.c,v 1.39 2012/01/20 07:09:42 tedu Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -123,7 +123,7 @@ typedef char Char;
#define ismeta(c) (((c)&M_QUOTE) != 0)
#define GLOB_LIMIT_MALLOC 65536
-#define GLOB_LIMIT_STAT 128
+#define GLOB_LIMIT_STAT 2048
#define GLOB_LIMIT_READDIR 16384
/* Limit of recursion during matching attempts. */
@@ -628,8 +628,6 @@ glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
for (anymeta = 0;;) {
if (*pattern == EOS) { /* End of pattern? */
*pathend = EOS;
- if (g_lstat(pathbuf, &sb, pglob))
- return(0);
if ((pglob->gl_flags & GLOB_LIMIT) &&
limitp->glim_stat++ >= GLOB_LIMIT_STAT) {
@@ -638,6 +636,8 @@ glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
*pathend = EOS;
return(GLOB_NOSPACE);
}
+ if (g_lstat(pathbuf, &sb, pglob))
+ return(0);
if (((pglob->gl_flags & GLOB_MARK) &&
pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) ||