diff options
| author | Mel <mel@rnrd.eu> | 2025-06-14 01:11:57 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2025-06-14 01:11:57 +0200 |
| commit | e262a180fea1a04c047071cad96d53a2f4b233c3 (patch) | |
| tree | 711179e05368e0116c5d0eff24bb64581ea593ee | |
| parent | 4eba2d39dc40775bbd18020593e46d1a367db357 (diff) | |
| download | catskill-e262a180fea1a04c047071cad96d53a2f4b233c3.tar.zst catskill-e262a180fea1a04c047071cad96d53a2f4b233c3.zip | |
Prevent mmap of empty file
Signed-off-by: Mel <mel@rnrd.eu>
| -rw-r--r-- | boot/catboot.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/boot/catboot.c b/boot/catboot.c index 23b649e..79a5e2b 100644 --- a/boot/catboot.c +++ b/boot/catboot.c @@ -31,6 +31,8 @@ read_file(const ascii* path) struct stat stat_info; if (stat(path, &stat_info) == -1) failure("i couldn't open that file, sorry :("); + check(stat_info.st_size > 0, "file is empty, i can't map an empty file"); + const int32 file_descriptor = open(path, O_RDONLY); check(file_descriptor != -1, "i couldn't open that file, sorry :("); |
