Skip to content

Commit 5cf1c83

Browse files
a3fsaschahauer
authored andcommitted
efi: payload: gracefully handle NULL parent image device path
device_path_to_filepath may be called on a device pth that contains no file path. In that case, the function should return NULL instead of dereferencing the NULL pointer. Fix this. Fixes: f1230c7 ("efi: payload: dynamically determine bootloader file name") Signed-off-by: Ahmad Fatoum <[email protected]> Link: https://lore.barebox.org/[email protected] Signed-off-by: Sascha Hauer <[email protected]>
1 parent 47d910f commit 5cf1c83

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

efi/devicepath.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,9 @@ char *device_path_to_filepath(const struct efi_device_path *dev_path)
824824
dev_path = next_device_path_node(&fp->header);
825825
}
826826

827+
if (!fp)
828+
return NULL;
829+
827830
path = strdup_wchar_to_char(fp->path_name);
828831
if (!path)
829832
return NULL;

0 commit comments

Comments
 (0)