diff options
author | 2009-06-04 08:29:13 +0000 | |
---|---|---|
committer | 2009-06-04 08:29:13 +0000 | |
commit | c62dc6093e6af9414c56cffa1c6c4e94d0d745ea (patch) | |
tree | 56ea840a3cd3befc4a98a9ee1e5bfd93f8a819c0 | |
parent | error out if count gets out of bounds. Happens with corrupted databases, (diff) | |
download | wireguard-openbsd-c62dc6093e6af9414c56cffa1c6c4e94d0d745ea.tar.xz wireguard-openbsd-c62dc6093e6af9414c56cffa1c6c4e94d0d745ea.zip |
in case a handling a +groupname:*:: entry fails due to lack of memory,
do not just skip the entry, but report the error condition;
ok millert@
-rw-r--r-- | lib/libc/gen/getgrent.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index 9a332a987a8..de250c73ab0 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getgrent.c,v 1.27 2009/06/03 16:02:44 schwarze Exp $ */ +/* $OpenBSD: getgrent.c,v 1.28 2009/06/04 08:29:13 schwarze Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -431,7 +431,8 @@ grscan(int search, gid_t gid, const char *name, struct group *p_gr, __ypexclude_is(&__ypexhead, tptr)) continue; __ypmode = YPMODE_NAME; - grname = strdup(tptr); + if ((grname = strdup(tptr)) == NULL) + return (0); continue; } break; |