diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/pwd_grp/pwd_grp.c | 8 |
1 files changed, 5 insertions, 3 deletions
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, |