Make sanity checks saner: don't let setnetgrent() or innetgr() swallow

any bogus arguments.
This commit is contained in:
wpaul 1995-03-24 20:42:28 +00:00
parent 6c6725060f
commit 7331337b36

View File

@ -96,10 +96,11 @@ void
setnetgrent(group)
char *group;
{
/* Sanity check: no null group names allowed! */
/* Sanity check */
if (group == NULL || *group == '\0')
if (group == NULL || !strlen(group))
return;
if (grouphead.gr == (struct netgrp *)0 ||
strcmp(group, grouphead.grname)) {
endnetgrent();
@ -184,6 +185,11 @@ innetgr(group, host, user, dom)
{
char *hst, *usr, *dm;
/* Sanity check */
if (group == NULL || !strlen(group))
return (0);
setnetgrent(group);
while (getnetgrent(&hst, &usr, &dm))
if ((host == (char *)0 || !strcmp(host, hst)) &&