summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getnetgrent.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-08-08 02:51:16 +0000
committerwpaul <wpaul@FreeBSD.org>1995-08-08 02:51:16 +0000
commit89b1e701089efa633c6f6e59a3fdf2d863240374 (patch)
tree1f8d208fa17f345b54e2a3fa2c0c40b8b845528b /lib/libc/gen/getnetgrent.c
parent224e922aeb3de1f0c6cb104f4dadde88aa3b3999 (diff)
downloadFreeBSD-src-89b1e701089efa633c6f6e59a3fdf2d863240374.zip
FreeBSD-src-89b1e701089efa633c6f6e59a3fdf2d863240374.tar.gz
Fix _listmatch() so that it doesn't fall off the end of the list string.
Diffstat (limited to 'lib/libc/gen/getnetgrent.c')
-rw-r--r--lib/libc/gen/getnetgrent.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index b26af50..572a93a 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -268,15 +268,14 @@ endnetgrent()
}
#ifdef YP
-static int _listmatch(list, group)
+static int _listmatch(list, group, len)
char *list, *group;
+int len;
{
char *ptr = list;
- while (ptr != NULL) {
- if (!strncmp(ptr, group, strlen(group)) &&
- (*(ptr+strlen(group)) == ',' ||
- *(ptr+strlen(group)) == '\n'))
+ while (ptr != (char *)(list + len)) {
+ if (!strncmp(group, ptr, strlen(group)))
return(1);
ptr++;
}
@@ -342,7 +341,7 @@ innetgr(group, host, user, dom)
&resultlen))
free(result);
else {
- if (_listmatch(result, group)) {
+ if (_listmatch(result, group, resultlen)) {
free(result);
return(1);
}
OpenPOWER on IntegriCloud