]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(format_user): Increment dired_pos via two statements,
authorJim Meyering <jim@meyering.net>
Thu, 18 Dec 2003 17:15:38 +0000 (17:15 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 18 Dec 2003 17:15:38 +0000 (17:15 +0000)
`dired_pos += width; dired_pos++;' rather than one,
`dired_pos += width + 1;' since the latter could conceivably overflow.
(format_group): Likewise.

src/ls.c

index 8126b8c60d2234d64f76e02c39ab83bf5c560511..6f8bc33801af8945f083c2b113827032da9bb89f 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -2982,7 +2982,8 @@ format_user (uid_t u, int width)
     printf ("%-*s ", width, name);
   else
     printf ("%*lu ", width, (unsigned long int) u);
-  dired_pos += width + 1;
+  dired_pos += width;
+  dired_pos++;
 }
 
 /* Likewise, for groups.  */
@@ -2995,7 +2996,8 @@ format_group (gid_t g, int width)
     printf ("%-*s ", width, name);
   else
     printf ("%*lu ", width, (unsigned long int) g);
-  dired_pos += width + 1;
+  dired_pos += width;
+  dired_pos++;
 }
 
 /* Return the number of bytes that format_user will print.  */