Fix off by one bug in pwcashe routine group_from_gid().

This commit is contained in:
jtc 1994-01-19 21:15:46 +00:00
parent 4f4897ff25
commit e304028c04
2 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
/*static char sccsid[] = "from: @(#)pwcache.c 5.4 (Berkeley) 6/1/90";*/ /*static char sccsid[] = "from: @(#)pwcache.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: pwcache.c,v 1.2 1993/08/01 18:31:46 mycroft Exp $"; static char rcsid[] = "$Id: pwcache.c,v 1.3 1994/01/19 21:15:46 jtc Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -87,7 +87,7 @@ group_from_gid(gid, nogroup)
{ {
static struct ncache { static struct ncache {
gid_t gid; gid_t gid;
char name[UT_NAMESIZE]; char name[UT_NAMESIZE + 1];
} c_gid[NCACHE]; } c_gid[NCACHE];
static char nbuf[15]; /* 32 bits == 10 digits */ static char nbuf[15]; /* 32 bits == 10 digits */
register struct group *gr; register struct group *gr;

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
/*static char sccsid[] = "from: @(#)pwcache.c 5.4 (Berkeley) 6/1/90";*/ /*static char sccsid[] = "from: @(#)pwcache.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: pwcache.c,v 1.2 1993/08/01 18:31:46 mycroft Exp $"; static char rcsid[] = "$Id: pwcache.c,v 1.3 1994/01/19 21:15:46 jtc Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -87,7 +87,7 @@ group_from_gid(gid, nogroup)
{ {
static struct ncache { static struct ncache {
gid_t gid; gid_t gid;
char name[UT_NAMESIZE]; char name[UT_NAMESIZE + 1];
} c_gid[NCACHE]; } c_gid[NCACHE];
static char nbuf[15]; /* 32 bits == 10 digits */ static char nbuf[15]; /* 32 bits == 10 digits */
register struct group *gr; register struct group *gr;