aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorHeinrich Schuchardt2019-04-23 00:51:01 +0200
committerHeinrich Schuchardt2019-04-23 00:51:01 +0200
commit7d1e4b73e3f321cd4f0e039aa0387484cf97b25c (patch)
tree3127c43d27178fa49c8c815115afd8961562f144 /lib/efi_loader
parentf12bcc9149c32a01dac687718ad126d4d3ba29ba (diff)
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 <xypron.glpk@gmx.de>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_device_path.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 6104c7d33b7..10f890f44f6 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;