mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-23 07:39:22 +00:00
* grub-core/kern/file.c (grub_file_read): Read nothing if len = 0.
Special behaviour for len = 0 to read whole file isn't used anywhere and can cause buffer ovewrflows in several places.
This commit is contained in:
1 parent
f0a53ed2c2
commit
a188012e6c
2 files changed
+10
-1
No files matched your search
@@ -143,7 +143,10 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len == 0 || len > file->size - file->offset)
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
if (len > file->size - file->offset)
|
||||
len = file->size - file->offset;
|
||||
|
||||
/* Prevent an overflow. */
|
||||
|
||||
Reference in new issue
Block a user