diff options
author | wpaul <wpaul@FreeBSD.org> | 1995-03-24 20:42:28 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1995-03-24 20:42:28 +0000 |
commit | 7331337b36be23447cb449667596c708dfac76ae (patch) | |
tree | f3f82cf42f41abbfcf39959b14a50bd177c11645 /lib/libc | |
parent | 6c6725060f4324360f59d3d890d39966e5a29cc6 (diff) | |
download | FreeBSD-src-7331337b36be23447cb449667596c708dfac76ae.zip FreeBSD-src-7331337b36be23447cb449667596c708dfac76ae.tar.gz |
Make sanity checks saner: don't let setnetgrent() or innetgr() swallow
any bogus arguments.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 68e5ebd..1b581cf 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -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)) && |