]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__fgetpwent_r): Correct buffer overflow fix.
authorUlrich Drepper <drepper@redhat.com>
Mon, 8 Jun 1998 09:54:39 +0000 (09:54 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 8 Jun 1998 09:54:39 +0000 (09:54 +0000)
pwd/fgetpwent_r.c

index 7f95a1a40edd1522dcef0cb7c2d7e4e89236f2bd..7e72b2e67ed09689cba577cd276e5bb9e1714990 100644 (file)
@@ -73,14 +73,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;