aboutsummaryrefslogtreecommitdiff
path: root/grp
diff options
context:
space:
mode:
Diffstat (limited to 'grp')
-rw-r--r--grp/fgetgrent_r.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/grp/fgetgrent_r.c b/grp/fgetgrent_r.c
index de11326139..0c87815064 100644
--- a/grp/fgetgrent_r.c
+++ b/grp/fgetgrent_r.c
@@ -61,14 +61,14 @@ __fgetgrent_r (FILE *stream, struct group *resbuf, char *buffer, size_t buflen,
do
{
- buffer[buflen] = '\xff';
+ buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, stream);
if (p == NULL && feof (stream))
{
*result = NULL;
return errno;
}
- if (p == NULL || buffer[buflen] != '\xff')
+ if (p == NULL || buffer[buflen - 1] != '\xff')
{
*result = NULL;
return errno = ERANGE;