summaryrefslogtreecommitdiffstats
path: root/src/boot/efi/util.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:18:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:18:14 +0000
commit67c5de60daa85b91fa68be4157e248fa31e75316 (patch)
tree7d567f3360f705ac21600343ef7f7cea645a9222 /src/boot/efi/util.c
parentAdding upstream version 256.1. (diff)
downloadsystemd-06a0a2fdeaf41892705cfec541146336e3c21087.tar.xz
systemd-06a0a2fdeaf41892705cfec541146336e3c21087.zip
Adding upstream version 256.2.upstream/256.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boot/efi/util.c')
-rw-r--r--src/boot/efi/util.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c
index b5c8c63..eb29eb2 100644
--- a/src/boot/efi/util.c
+++ b/src/boot/efi/util.c
@@ -330,7 +330,14 @@ EFI_STATUS chunked_read(EFI_FILE *file, size_t *size, void *buf) {
return EFI_SUCCESS;
}
-EFI_STATUS file_read(EFI_FILE *dir, const char16_t *name, size_t off, size_t size, char **ret, size_t *ret_size) {
+EFI_STATUS file_read(
+ EFI_FILE *dir,
+ const char16_t *name,
+ uint64_t off,
+ size_t size,
+ char **ret,
+ size_t *ret_size) {
+
_cleanup_(file_closep) EFI_FILE *handle = NULL;
_cleanup_free_ char *buf = NULL;
EFI_STATUS err;
@@ -350,6 +357,9 @@ EFI_STATUS file_read(EFI_FILE *dir, const char16_t *name, size_t off, size_t siz
if (err != EFI_SUCCESS)
return err;
+ if (info->FileSize > SIZE_MAX)
+ return EFI_BAD_BUFFER_SIZE;
+
size = info->FileSize;
}