projects
/
platform
/
kernel
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7d82374
)
efi_loader: memory leak in efi_capsule_scan_dir()
author
Heinrich Schuchardt
<xypron.glpk@gmx.de>
Sun, 11 Apr 2021 04:53:04 +0000
(06:53 +0200)
committer
Heinrich Schuchardt
<xypron.glpk@gmx.de>
Sat, 17 Apr 2021 18:01:32 +0000
(20:01 +0200)
If realloc() fails, we should free the old buffer.
Fixes:
c74cd8bd08d1
: ("efi_loader: capsule: add capsule_on_disk support")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_capsule.c
patch
|
blob
|
history
diff --git
a/lib/efi_loader/efi_capsule.c
b/lib/efi_loader/efi_capsule.c
index
9df9c35
..
691eda5
100644
(file)
--- a/
lib/efi_loader/efi_capsule.c
+++ b/
lib/efi_loader/efi_capsule.c
@@
-756,8
+756,11
@@
static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num)
tmp_size = dirent_size;
ret = EFI_CALL((*dirh->read)(dirh, &tmp_size, dirent));
if (ret == EFI_BUFFER_TOO_SMALL) {
+ struct efi_file_info *old_dirent = dirent;
+
dirent = realloc(dirent, tmp_size);
if (!dirent) {
+ dirent = old_dirent;
ret = EFI_OUT_OF_RESOURCES;
goto err;
}