]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
grub-core/loader/efi/fdt.c: Do not copy random memory
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 17 Dec 2018 21:00:24 +0000 (22:00 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 14 Jan 2019 10:53:52 +0000 (11:53 +0100)
We should not try to copy any memory area which is outside of the original
fdt. If this extra memory is controlled by a hypervisor this might end
with a crash.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/loader/efi/fdt.c

index a18ca8ccb3fd8f2ea51c598a83d9f64b30eaa631..ee9c5592c7008813649ff50840b930195b602fd8 100644 (file)
@@ -66,7 +66,7 @@ grub_fdt_load (grub_size_t additional_size)
 
   if (raw_fdt)
     {
-      grub_memmove (fdt, raw_fdt, size);
+      grub_memmove (fdt, raw_fdt, size - additional_size);
       grub_fdt_set_totalsize (fdt, size);
     }
   else