From 6ed9366c271943c6ddb078cd10172cd3da97b6d6 Mon Sep 17 00:00:00 2001 From: elad Date: Tue, 13 Sep 2005 21:38:03 +0000 Subject: [PATCH] Don't overflow when DEBUG is defined. PR/30833, from Tomas Skare. --- lib/libc/gen/glob.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c index f183da353fb5..5064d17c1746 100644 --- a/lib/libc/gen/glob.c +++ b/lib/libc/gen/glob.c @@ -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)); }