]> git.ipfire.org Git - thirdparty/grub.git/commit
fs: Prevent overflows when assigning returned values from read_number()
authorLidong Chen <lidong.chen@oracle.com>
Tue, 21 Jan 2025 19:02:38 +0000 (19:02 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 13 Feb 2025 14:45:57 +0000 (15:45 +0100)
commitcde9f7f338f8f5771777f0e7dfc423ddf952ad31
treef0aebfd983d8015b962ff15be9c5ef2a365f5191
parent84bc0a9a68835952ae69165c11709811dae7634e
fs: Prevent overflows when assigning returned values from read_number()

The direct assignment of the unsigned long long value returned by
read_number() can potentially lead to an overflow on a 32-bit systems.
The fix replaces the direct assignments with calls to grub_cast()
which detects the overflows and safely assigns the values if no
overflow is detected.

Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/cpio_common.c
grub-core/fs/tar.c