diff options
author | Damien Miller <djm@mindrot.org> | 2019-11-15 15:07:30 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-11-15 15:07:30 +1100 |
commit | bb7413db98e418d4af791244660abf6c829783f5 (patch) | |
tree | b0ed3f784866f4147ddc68548f6e745187653a9e /openbsd-compat | |
parent | 01362cf7cb979525c014714e2bccf799a46e772e (diff) |
upstream commit
revision 1.39
date: 2012/01/20 07:09:42; author: tedu; state: Exp; lines: +4 -4;
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
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/glob.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c index 7c97e67f5..2166a71a2 100644 --- a/openbsd-compat/glob.c +++ b/openbsd-compat/glob.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: glob.c,v 1.38 2011/09/22 06:27:29 djm Exp $ */ | 1 | /* $OpenBSD: glob.c,v 1.39 2012/01/20 07:09:42 tedu Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1989, 1993 | 3 | * Copyright (c) 1989, 1993 |
4 | * The Regents of the University of California. All rights reserved. | 4 | * The Regents of the University of California. All rights reserved. |
@@ -131,7 +131,7 @@ typedef char Char; | |||
131 | #define ismeta(c) (((c)&M_QUOTE) != 0) | 131 | #define ismeta(c) (((c)&M_QUOTE) != 0) |
132 | 132 | ||
133 | #define GLOB_LIMIT_MALLOC 65536 | 133 | #define GLOB_LIMIT_MALLOC 65536 |
134 | #define GLOB_LIMIT_STAT 128 | 134 | #define GLOB_LIMIT_STAT 2048 |
135 | #define GLOB_LIMIT_READDIR 16384 | 135 | #define GLOB_LIMIT_READDIR 16384 |
136 | 136 | ||
137 | /* Limit of recursion during matching attempts. */ | 137 | /* Limit of recursion during matching attempts. */ |
@@ -639,8 +639,6 @@ glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last, | |||
639 | for (anymeta = 0;;) { | 639 | for (anymeta = 0;;) { |
640 | if (*pattern == EOS) { /* End of pattern? */ | 640 | if (*pattern == EOS) { /* End of pattern? */ |
641 | *pathend = EOS; | 641 | *pathend = EOS; |
642 | if (g_lstat(pathbuf, &sb, pglob)) | ||
643 | return(0); | ||
644 | 642 | ||
645 | if ((pglob->gl_flags & GLOB_LIMIT) && | 643 | if ((pglob->gl_flags & GLOB_LIMIT) && |
646 | limitp->glim_stat++ >= GLOB_LIMIT_STAT) { | 644 | limitp->glim_stat++ >= GLOB_LIMIT_STAT) { |
@@ -649,6 +647,8 @@ glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last, | |||
649 | *pathend = EOS; | 647 | *pathend = EOS; |
650 | return(GLOB_NOSPACE); | 648 | return(GLOB_NOSPACE); |
651 | } | 649 | } |
650 | if (g_lstat(pathbuf, &sb, pglob)) | ||
651 | return(0); | ||
652 | 652 | ||
653 | if (((pglob->gl_flags & GLOB_MARK) && | 653 | if (((pglob->gl_flags & GLOB_MARK) && |
654 | pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) || | 654 | pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) || |