Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen Fix sentinel for the buffer in globtilde. It wa...



details:   https://anonhg.NetBSD.org/src/rev/670950319bfa
branches:  trunk
changeset: 507945:670950319bfa
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 03 14:50:37 2001 +0000

description:
Fix sentinel for the buffer in globtilde. It was off by x 2. Noted by Theo.

diffstat:

 lib/libc/gen/__glob13.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 613ab36927aa -r 670950319bfa lib/libc/gen/__glob13.c
--- a/lib/libc/gen/__glob13.c   Tue Apr 03 14:06:31 2001 +0000
+++ b/lib/libc/gen/__glob13.c   Tue Apr 03 14:50:37 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: __glob13.c,v 1.20 2001/03/28 22:53:40 christos Exp $   */
+/*     $NetBSD: __glob13.c,v 1.21 2001/04/03 14:50:37 christos Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)glob.c     8.3 (Berkeley) 10/13/93";
 #else
-__RCSID("$NetBSD: __glob13.c,v 1.20 2001/03/28 22:53:40 christos Exp $");
+__RCSID("$NetBSD: __glob13.c,v 1.21 2001/04/03 14:50:37 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -171,7 +171,7 @@
 static int      glob3 __P((Char *, Char *, Char *, Char *, glob_t *,
     size_t *));
 static int      globextend __P((const Char *, glob_t *, size_t *));
-static const Char *     globtilde __P((const Char *, Char *, size_t, glob_t *));
+static const Char *globtilde __P((const Char *, Char *, size_t, glob_t *));
 static int      globexp1 __P((const Char *, glob_t *));
 static int      globexp2 __P((const Char *, const Char *, glob_t *, int *));
 static int      match __P((Char *, Char *, Char *));
@@ -385,7 +385,7 @@
        const Char *p;
        Char *b;
        char *d;
-       Char *pend = &patbuf[patsize];
+       Char *pend = &patbuf[patsize / sizeof(Char)];
 
        pend--;
 
@@ -468,7 +468,8 @@
        _DIAGASSERT(pattern != NULL);
        _DIAGASSERT(pglob != NULL);
 
-       if ((qpatnext = globtilde(pattern, patbuf, sizeof(patbuf), pglob)) == NULL)
+       if ((qpatnext = globtilde(pattern, patbuf, sizeof(patbuf),
+           pglob)) == NULL)
                return GLOB_ABEND;
        oldpathc = pglob->gl_pathc;
        bufnext = patbuf;



Home | Main Index | Thread Index | Old Index