Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen Check for NULL *before* using ALIGN().
details: https://anonhg.NetBSD.org/src/rev/a3e0b59d31ea
branches: trunk
changeset: 781259:a3e0b59d31ea
user: dholland <dholland%NetBSD.org@localhost>
date: Wed Aug 29 18:50:35 2012 +0000
description:
Check for NULL *before* using ALIGN().
I don't remember what prompted this, but it's obviously a desirable fix
and I've been carrying it on a heavily-used machine for more than a year.
diffstat:
lib/libc/gen/getgrent.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r 91b0d08842db -r a3e0b59d31ea lib/libc/gen/getgrent.c
--- a/lib/libc/gen/getgrent.c Wed Aug 29 18:46:13 2012 +0000
+++ b/lib/libc/gen/getgrent.c Wed Aug 29 18:50:35 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getgrent.c,v 1.66 2012/03/29 13:05:10 christos Exp $ */
+/* $NetBSD: getgrent.c,v 1.67 2012/08/29 18:50:35 dholland Exp $ */
/*-
* Copyright (c) 1999-2000, 2004-2005 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
#if 0
static char sccsid[] = "@(#)getgrent.c 8.2 (Berkeley) 3/21/94";
#else
-__RCSID("$NetBSD: getgrent.c,v 1.66 2012/03/29 13:05:10 christos Exp $");
+__RCSID("$NetBSD: getgrent.c,v 1.67 2012/08/29 18:50:35 dholland Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -221,9 +221,9 @@
}
/* grab ALIGNed char **gr_mem from buf */
ep = _gr_memfrombuf(memc * sizeof(char *) + ALIGNBYTES, &buf, &buflen);
+ if (ep == NULL)
+ return 0;
grp->gr_mem = (char **)ALIGN(ep);
- if (grp->gr_mem == NULL)
- return 0;
for (memc = 0; *entry != '\0'; memc++) {
count = strcspn(entry, ","); /* parse member */
Home |
Main Index |
Thread Index |
Old Index