[U-Boot] [PATCH 1/1] efi_loader: check length in CreateDeviceNode()

23 Apr
2019
23 Apr
'19
12:54 a.m.
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 xypron.glpk@gmx.de --- lib/efi_loader/efi_device_path.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 6104c7d33b..10f890f44f 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; -- 2.20.1
2214
Age (days ago)
2214
Last active (days ago)
0 comments
1 participants
participants (1)
-
Heinrich Schuchardt