projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
12643e7
)
systemd-boot: fix off-by-one buffer overrun
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 7 Mar 2018 07:51:09 +0000
(08:51 +0100)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 7 Mar 2018 08:03:23 +0000
(09:03 +0100)
We'd allocate a buffer of some size and then write zero to the byte one after.
src/boot/efi/util.c
patch
|
blob
|
history
diff --git
a/src/boot/efi/util.c
b/src/boot/efi/util.c
index
bff8ba8
..
cd75c13
100644
(file)
--- a/
src/boot/efi/util.c
+++ b/
src/boot/efi/util.c
@@
-327,16
+327,15
@@
EFI_STATUS file_read(EFI_FILE_HANDLE dir, CHAR16 *name, UINTN off, UINTN size, C
return err;
}
- buf = AllocatePool(size);
+ buf = AllocatePool(size
+ 1
);
err = uefi_call_wrapper(handle->Read, 3, handle, &size, buf);
if (!EFI_ERROR(err)) {
buf[size] = '\0';
*content = buf;
if (content_size)
*content_size = size;
- } else
{
+ } else
FreePool(buf);
- }
uefi_call_wrapper(handle->Close, 1, handle);
return err;