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

any bogus arguments.
This commit is contained in:
Bill Paul 1995-03-24 20:42:28 +00:00
parent a29ae2a103
commit 0ffe27f544
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7336

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)) &&