mirror of
https://github.com/smaeul/u-boot.git
synced 2025-11-27 06:14:41 +00:00
efi_loader: catch out of memory in file_open
If calloc() return NULL, don't dereference it.
Fixes: 2a92080d8c44 ("efi_loader: add file/filesys support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
cff7700170
commit
405b736e81
@ -195,6 +195,8 @@ static struct efi_file_handle *file_open(struct file_system *fs,
|
||||
|
||||
/* +2 is for null and '/' */
|
||||
fh = calloc(1, sizeof(*fh) + plen + (flen * MAX_UTF8_PER_UTF16) + 2);
|
||||
if (!fh)
|
||||
return NULL;
|
||||
|
||||
fh->open_mode = open_mode;
|
||||
fh->base = efi_file_handle_protocol;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user