From 650cfcfea20b580a7b6fd8282c42d75a107f0abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= Date: Mon, 25 Jun 2012 10:09:57 +0200 Subject: [PATCH] Fix overflow in grub_util_get_fd_size for NetBSD. --- ChangeLog | 7 +++++++ grub-core/kern/emu/hostdisk.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 20e41b6ef..e62028e8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-06-25 Grégoire Sutre + + Fix overflow. + + * grub-core/kern/emu/hostdisk.c (grub_util_get_fd_size) + [__NetBSD__]: Add explicit cast before bitshift. + 2012-06-23 Vladimir Serbinenko * configure.ac: Bump to 2.00~rc1. diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c index 43db9d6ec..b8c376643 100644 --- a/grub-core/kern/emu/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -309,7 +309,7 @@ grub_util_get_fd_size (int fd, const char *name, unsigned *log_secsize) # if defined (__APPLE__) return nr << log_sector_size; # elif defined(__NetBSD__) - return label.d_secperunit << log_sector_size; + return (grub_uint64_t) label.d_secperunit << log_sector_size; # elif defined (__sun__) return minfo.dki_capacity << log_sector_size; # else