Commit Graph

18 Commits

Author SHA1 Message Date
Mike Heffner
75dc5f1a82 Rename the GLOB_MAXPATH flag of glob(3) to GLOB_LIMIT to be compatible
with NetBSD and OpenBSD. glob(3) will now return GLOB_NOSPACE with
errno set to 0 instead of GLOB_LIMIT when we match more than `gl_matchc'
patterns. GLOB_MAXPATH has been left as an alias of GLOB_LIMIT to
maintain backwards compatibility.

Reviewed by:	sheldonh, assar
Obtained from:	NetBSD/OpenBSD
2001-07-29 00:52:37 +00:00
Peter Wemm
487dbd927f Mostly pick up OpenBSD's rev 1.14 by deraadt@ and millert@.
I've left out a couple of unused args between internal functions.
Use MAXPATHLEN, not MAXPATHLEN + 1 in a couple of places.
Pass a pointer to the end of the target filename space.
2001-03-28 23:55:51 +00:00
Peter Wemm
27d52f6943 OpenBSD's g_Ctoc() returned a false error when the target buffer was
exactly the right size.  Do it differently - pass a length rather than an
end-of-string+1 pointer as this is more convenient anyway.  Get rid of
the bogus +1's.
2001-03-28 10:56:11 +00:00
Peter Wemm
76e2bc010d Fix g_Ctoc() interface, approximately based on OpenBSD's recent changes.
Also, set gl_pathv to NULL after we free it, especially when dealing
with realloc failures.

Obtained from: OpenBSD
2001-03-28 09:53:16 +00:00
Jonathan Lemon
bae8632f82 Introduce the GLOB_MAXPATH flag, which allows the user to limit the
number of paths which glob(3) will return.  Remove the hardcoded limit
from the last commit, which restores the previous unbounded behavior.

Document the new flag in the manual page.
2001-03-19 19:10:06 +00:00
Jonathan Lemon
daa4742e72 Bump MAX_GLOBENTRIES up to 16384, so it is a power of two. Add
some comments explaining that this is an arbitrary limit.

Requested by:  jkh
2001-03-16 19:05:20 +00:00
Jonathan Lemon
813c96dbd7 Limit the number of paths that glob can return to MAX_GLOBENTRIES, which
is currently set to 10000.  This is intended to prevent glob from running
amok when a highly recursive path is provided (such as "../*/../*/../*/...")

Reviewed by: Diane Bruce <db@db.net>, jhb
2001-03-15 18:50:32 +00:00
John Birrell
9fcbcd0217 NetBSD kernels don't have issetugid(), so #ifdef this out when
building FreeBSD's libc to run with a NetBSD kernel. We'll get to
the alpha kernel later, I promise. 8-)
1998-02-20 07:54:56 +00:00
Andrey A. Chernov
eb8eee5a55 Use getpwnam(getlogin()) before getpwuid(getuid()) 1997-08-27 13:36:34 +00:00
Warner Losh
3fa69daee8 Don't getenv(HOME) when set[ug]od. This can lead to a buffer overflow and
elevated privs.
Obtained from: OpenBSD
1997-08-27 05:27:53 +00:00
Andrey A. Chernov
21d58869ce Speedup in case locale not used 1997-04-04 19:16:08 +00:00
Warner Losh
62f187a4cf Buffer overflow. Similar, but different, to the fix that Julian A submitted
in PR 2580.

Obtained from: BSDi by way of Keith Bostic

Should be in 2.2 and 2.1.x.  I'll merge into 2.2.
1997-03-23 23:31:50 +00:00
Andrey A. Chernov
edcfa07284 collate_range_cmp -> __collate_range_cmp 1996-10-31 04:32:27 +00:00
Andrey A. Chernov
79deb12410 Convert to newly aded collate compare function 1996-08-12 18:49:54 +00:00
Andrey A. Chernov
89ec343a7f Remove static collcmp, ise new internal function now 1996-08-12 03:45:53 +00:00
Andrey A. Chernov
b92a8919d1 Use collate for alpha character ranges 1996-08-12 02:00:56 +00:00
Rodney W. Grimes
6c06b4e2aa Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
Rodney W. Grimes
58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00