From d5465499fbc28031bc047f0cdcf13c1dde89b923 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Thu, 6 Nov 2003 22:01:03 +0000 Subject: Sigh... I wasn't checking if the gid field in a group line actually contained a digit. Also adjust a comment. --- libc/pwd_grp/pwd_grp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libc/pwd_grp') diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index a48901428..74f784231 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -966,7 +966,11 @@ int __parsegrent(void *data, char *line) /* NOTE: glibc difference - glibc allows omission of the * trailing colon when there is no member list. We treat * this as an error. */ - if (*endptr != ':') { + + /* Make sure we had at least one digit, and that the + * failing char is the next field seperator ':'. See + * glibc difference note above. */ + if ((endptr == line) || (*endptr != ':')) { break; } @@ -1104,8 +1108,6 @@ int __parsespent(void *data, char * line) * and for which the parser function succeeds. * * Returns 0 on success and ENOENT for end-of-file (glibc concession). - * On error, it both sets errno to ERANGE and returns ERANGE. - * (seems to be glibc behavior.) */ int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, -- cgit v1.2.3