Don't overflow when DEBUG is defined.

PR/30833, from Tomas Skare.
This commit is contained in:
elad 2005-09-13 21:38:03 +00:00
parent 2ddaf8b92b
commit 6ed9366c27
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: glob.c,v 1.12 2005/09/13 01:44:09 christos Exp $ */
/* $NetBSD: glob.c,v 1.13 2005/09/13 21:38:03 elad Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
#else
__RCSID("$NetBSD: glob.c,v 1.12 2005/09/13 01:44:09 christos Exp $");
__RCSID("$NetBSD: glob.c,v 1.13 2005/09/13 21:38:03 elad Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -581,7 +581,9 @@ glob1(pattern, pglob, limit)
* we save one character so that we can use ptr >= limit,
* in the general case when we are appending non nul chars only.
*/
return(glob2(pathbuf, pathbuf, pathbuf + sizeof(pathbuf) - 1, pattern,
return(glob2(pathbuf, pathbuf,
pathbuf + (sizeof(pathbuf) / sizeof(*pathbuf)) - 1,
pattern,
pglob, limit));
}