util/misc.c: Check ftello return value.
authorVladimir Serbinenko <phcoder@gmail.com>
Mon, 26 Jan 2015 08:56:24 +0000 (09:56 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Mon, 26 Jan 2015 08:56:24 +0000 (09:56 +0100)
Found by: Coverity scan.

util/misc.c

index b0e023e..b8ec691 100644 (file)
@@ -89,6 +89,8 @@ grub_util_get_image_size (const char *path)
   fseeko (f, 0, SEEK_END);
   
   sz = ftello (f);
+  if (sz < 0)
+    grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
   if (sz != (size_t) sz)
     grub_util_error (_("file `%s' is too big"), path);
   ret = (size_t) sz;