]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: check input parameter 21065/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 20 Oct 2021 11:57:38 +0000 (13:57 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 20 Oct 2021 12:20:44 +0000 (14:20 +0200)
clang complained about an unused variable. We cast the buffer to
struct boot_params, so let's check that it's at least this long.

src/boot/efi/linux_x86.c

index 98b2366ad28a41fc9989763e73480c4fd27c05cb..15052bdff65ccffabb261fac014ea78e305c1b45 100644 (file)
@@ -138,6 +138,9 @@ EFI_STATUS linux_exec(
         assert(linux_buffer);
         assert(initrd_buffer || initrd_length == 0);
 
+        if (linux_length < sizeof(struct boot_params))
+                return EFI_LOAD_ERROR;
+
         image_params = (const struct boot_params *) linux_buffer;
 
         if (image_params->hdr.boot_flag != 0xAA55 ||