findutils-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Findutils-patches] patch for 20751 memory corruption in -ls


From: Eric Blake
Subject: [Findutils-patches] patch for 20751 memory corruption in -ls
Date: Sat, 11 Aug 2007 07:47:03 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

OK to apply, to both branch and head?  The testsuite doesn't exercise -ls,
because it is timestamp dependent.  Maybe we should rethink that, and come
up with a way to do an -ls test.  By the way, the THANKS file could
probably use a good cleanup; there have been more people contributing via
savannah than what THANKS listed (I omitted the THANKS patch so that I'm
not posting raw email addressed of random contributers in the past).

2007-08-11  Eric Blake  <address@hidden>

        Fix Savannah bug #20751.
        * lib/listfile.c (list_file): Accomodate gnulib change of 3 Jul
        2006.
        * NEWS: Document this.
        * THANKS: Sort and update.
        Reported by Nigel Stepp.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGvb3X84KuGfSFAYARArkLAJ4mzS34Yl9ZQw620L8sJAcCijPFbgCgtseq
A5bryIPIPphGvEZEfrIcbOI=
=k/wl
-----END PGP SIGNATURE-----
Index: NEWS
===================================================================
RCS file: /sources/findutils/findutils/NEWS,v
retrieving revision 1.200
diff -u -p -r1.200 NEWS
--- NEWS        5 Aug 2007 12:22:13 -0000       1.200
+++ NEWS        11 Aug 2007 13:44:59 -0000
@@ -30,6 +30,9 @@ standards.
 #20662: Avoid memory leak in find -name and other places affected by
 gnulib dirname module.  The leak had been present since 4.3.1.
 
+#20751: Avoid memory corruption in find -ls that has been present
+since 4.3.1.
+
 ** Enhancements
 
 #20594: Allow fine-tuning of the default argument size used by xargs
Index: lib/listfile.c
===================================================================
RCS file: /sources/findutils/findutils/lib/listfile.c,v
retrieving revision 1.25
diff -u -p -r1.25 listfile.c
--- lib/listfile.c      2 Jul 2007 08:25:43 -0000       1.25
+++ lib/listfile.c      11 Aug 2007 13:44:59 -0000
@@ -196,7 +196,7 @@ list_file (const char *name,
           int literal_control_chars,
           FILE *stream)
 {
-  char modebuf[11];
+  char modebuf[12];
   struct tm const *when_local;
   char const *user_name;
   char const *group_name;
@@ -208,7 +208,6 @@ list_file (const char *name,
 #else
   strmode (statp->st_mode, modebuf);
 #endif
-  modebuf[10] = '\0';
 
   fprintf (stream, "%6s ",
           human_readable ((uintmax_t) statp->st_ino, hbuf,
@@ -221,9 +220,9 @@ list_file (const char *name,
                           ST_NBLOCKSIZE, output_block_size));
 
 
-  /* The space between the mode and the number of links is the POSIX
-     "optional alternate access method flag".  */
-  fprintf (stream, "%s %3lu ", modebuf, (unsigned long) statp->st_nlink);
+  /* modebuf includes the space between the mode and the number of links,
+     as the POSIX "optional alternate access method flag".  */
+  fprintf (stream, "%s%3lu ", modebuf, (unsigned long) statp->st_nlink);
 
   user_name = getuser (statp->st_uid);
   if (user_name)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]