aboutsummaryrefslogtreecommitdiff
path: root/shadow/fgetspent_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'shadow/fgetspent_r.c')
-rw-r--r--shadow/fgetspent_r.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/shadow/fgetspent_r.c b/shadow/fgetspent_r.c
index cb14a23..bf4a3f8 100644
--- a/shadow/fgetspent_r.c
+++ b/shadow/fgetspent_r.c
@@ -41,14 +41,14 @@ __fgetspent_r (FILE *stream, struct spwd *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;