[Libguestfs] [PATCH supermin 7/9] kernel: Don't allow End_of_file exception to escape if kernel is bogus (RHBZ#1477758).

Richard W.M. Jones rjones at redhat.com
Thu Aug 3 12:59:29 UTC 2017


If the kernel file is truncated (zero length or too short) then
functions such as ‘really_input’ raise End_of_file.  Unfortunately
this exception could escape and kill the program.  What we want to do
instead is to ignore such kernels.  The combination of this commit and
the last commit ignores such kernels if they are found in /boot.

Reported by Charlie Martinez.
---
 src/format_ext2_kernel.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index 55c5af9..e329adb 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -273,6 +273,7 @@ and get_kernel_version_from_file_content file =
     Some version
   with
   | Not_found
+  | End_of_file
   | Sys_error _
   | Invalid_argument _ -> None
 
-- 
2.13.1




More information about the Libguestfs mailing list