From a1368118864dea5cf293eb3e669a75cf6af14773 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 5 Jan 2010 12:40:30 +0000 Subject: [PATCH] 2010-01-05 Colin Watson * util/mkisofs/write.c (padblock_write): Check return value of fread. --- ChangeLog | 5 +++++ util/mkisofs/write.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d9d327bac..061fadc18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-01-05 Colin Watson + + * util/mkisofs/write.c (padblock_write): Check return value of + fread. + 2010-01-05 Robert Millan Remove grub-mkfloppy. Images produced by grub-mkrescue are valid diff --git a/util/mkisofs/write.c b/util/mkisofs/write.c index 896e2833b..d9b1fd05d 100644 --- a/util/mkisofs/write.c +++ b/util/mkisofs/write.c @@ -1437,7 +1437,9 @@ static int FDECL1(padblock_write, FILE *, outfile) if (! fp) error (1, errno, _("Unable to open %s"), boot_image_embed); - fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp); + if (fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp) == 0) + error (1, errno, _("cannot read %llu bytes from %s"), + (size_t) (2048 * PADBLOCK_SIZE), boot_image_embed); if (fgetc (fp) != EOF) error (1, 0, _("%s is too big for embed area"), boot_image_embed); }