diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index a7ab735c0cd6..68e5ebda39b2 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -96,6 +96,10 @@ void setnetgrent(group) char *group; { + /* Sanity check: no null group names allowed! */ + + if (group == NULL || *group == '\0') + return; if (grouphead.gr == (struct netgrp *)0 || strcmp(group, grouphead.grname)) { endnetgrent();