]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/grub-mkrescue.c (main): Check that fread succeeded.
authorVladimir Serbinenko <phcoder@gmail.com>
Fri, 29 Nov 2013 02:54:21 +0000 (03:54 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Fri, 29 Nov 2013 02:54:21 +0000 (03:54 +0100)
ChangeLog
util/grub-mkrescue.c

index 9208c7912e4d37434b730650d38c12939dcfd8ec..b5045e7ba66d4380ff7ef40073544806abca4c8a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-29  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * util/grub-mkrescue.c (main): Check that fread succeeded.
+
 2013-11-29  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * conf/Makefile.common: Remove -mexplicit-relocs and
index b081b3b213d7ee168508f18fffa05fa5965dff5d..d212cb645088eef52e0ddfab377e23d09da73bd6 100644 (file)
@@ -519,7 +519,9 @@ main (int argc, char *argv[])
              if (!bi)
                grub_util_error (_("cannot open `%s': %s"), bin,
                                 strerror (errno));
-             fread (buf, 1, 512, bi);
+             if (fread (buf, 1, 512, bi) != 512)
+               grub_util_error (_("cannot read `%s': %s"), bin,
+                                strerror (errno));
              fclose (bi);
              fwrite (buf, 1, 512, sa);
              
@@ -729,10 +731,18 @@ main (int argc, char *argv[])
       cdboot = grub_util_path_concat (2, source_dirs[GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275],
                                      "cdboot.img");
       in = grub_util_fopen (cdboot, "rb");
+      if (!in)
+       grub_util_error (_("cannot open `%s': %s"), cdboot,
+                        strerror (errno));
       out = grub_util_fopen (sysarea_img, "wb");
+      if (!out)
+       grub_util_error (_("cannot open `%s': %s"), sysarea_img,
+                        strerror (errno));
       memset (buf, 0, 512);
       fwrite (buf, 1, 512, out);
-      fread (buf, 1, 512, in);
+      if (fread (buf, 1, 512, in) != 512)
+       grub_util_error (_("cannot read `%s': %s"), cdboot,
+                        strerror (errno));
       fwrite (buf, 1, 512, out);
       fclose (in);
       fclose (out);