From: Heinrich Schuchardt Date: Mon, 22 Apr 2019 22:51:01 +0000 (+0200) Subject: efi_loader: check length in CreateDeviceNode() X-Git-Tag: v2019.07-rc1~8^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d1e4b73e3f321cd4f0e039aa0387484cf97b25c;p=platform%2Fkernel%2Fu-boot.git efi_loader: check length in CreateDeviceNode() When creating a device path node ensure that the size of the allocated memory at lest matches the size of the node header. Signed-off-by: Heinrich Schuchardt --- diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 6104c7d..10f890f 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -335,6 +335,9 @@ struct efi_device_path *efi_dp_create_device_node(const u8 type, { struct efi_device_path *ret; + if (length < sizeof(struct efi_device_path)) + return NULL; + ret = dp_alloc(length); if (!ret) return ret;