summaryrefslogtreecommitdiff
path: root/pwd
diff options
context:
space:
mode:
Diffstat (limited to 'pwd')
-rw-r--r--pwd/fgetpwent_r.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pwd/fgetpwent_r.c b/pwd/fgetpwent_r.c
index 534afd58f5..87ea1dedda 100644
--- a/pwd/fgetpwent_r.c
+++ b/pwd/fgetpwent_r.c
@@ -74,14 +74,14 @@ __fgetpwent_r (FILE *stream, struct passwd *resbuf, char *buffer,
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;