grub-devel
[Top][All Lists]
Advanced

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

ls and grub_vsprintf bug fixes.


From: Timothy Baldwin
Subject: ls and grub_vsprintf bug fixes.
Date: Fri, 21 Oct 2005 23:20:24 +0100
User-agent: KMail/1.8.2

Normal mode ls leaks disk handles because it doesn't close files properly.
grub_vsprintf doesn't terminate a string it passes to grub_strtoul.

Fixes below:

2005-10-21  Timothy Baldwin  <address@hidden>

        * commands/ls.c (grub_ls_list_files) <long format>:
        Close file with grub_file_close.

        * kern/misc.c (grub_vsprintf) <Read formatting parameters>:
        Terminate S.


diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x CVS grub2-submitted/commands/ls.c grub2-arm/commands/ls.c
--- grub2-submitted/commands/ls.c       2005-08-20 08:27:40.000000000 +0100
+++ grub2-arm/commands/ls.c     2005-10-21 22:14:35.000000000 +0100
@@ -130,7 +130,7 @@ grub_ls_list_files (char *dirname, int l
                grub_printf ("%-12d", file->size);
              
            }
-         (fs->close) (file);
+         grub_file_close (file);
        }
       else
        grub_printf ("%-12s", "DIR");
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x CVS grub2-submitted/kern/misc.c grub2-arm/kern/misc.c
--- grub2-submitted/kern/misc.c 2005-08-21 07:46:28.000000000 +0100
+++ grub2-arm/kern/misc.c       2005-10-21 19:21:46.000000000 +0100
@@ -577,8 +577,9 @@ grub_vsprintf (char *str, const char *fm
 
          if (p > fmt)
            {
-             char s[p - fmt];
+             char s[p - fmt + 1];
              grub_strncpy (s, fmt, p - fmt);
+             s[p - fmt] = 0;
              if (s[0] == '0')
                zerofill = '0';
              format1 = grub_strtoul (s, 0, 10);


-- 
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents!    Victory to the iraqi resistance!

Attachment: pgpQ_8Vo6bWhm.pgp
Description: PGP signature


reply via email to

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