* util/misc.c (grub_util_get_image_size): Check for overflow.
This commit is contained in:
parent
80b29fc9b4
commit
74763e9615
2 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/misc.c (grub_util_get_image_size): Check for overflow.
|
||||
|
||||
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/disk/raid6_recover.c (grub_raid_block_mulx): Use grub_size_t
|
||||
|
|
|
@ -79,6 +79,7 @@ grub_util_get_image_size (const char *path)
|
|||
{
|
||||
FILE *f;
|
||||
size_t ret;
|
||||
off_t sz;
|
||||
|
||||
f = grub_util_fopen (path, "rb");
|
||||
|
||||
|
@ -87,7 +88,10 @@ grub_util_get_image_size (const char *path)
|
|||
|
||||
fseeko (f, 0, SEEK_END);
|
||||
|
||||
ret = ftello (f);
|
||||
sz = ftello (f);
|
||||
if (sz != (size_t) sz)
|
||||
grub_util_error (_("file `%s' is too big"), path);
|
||||
ret = (size_t) sz;
|
||||
|
||||
fclose (f);
|
||||
|
||||
|
|
Loading…
Reference in a new issue