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)
committerFelix Zielcke <fzielcke@z-51.de>
Wed, 11 Jun 2025 15:42:34 +0000 (17:42 +0200)
commit7dcd3c35fbc2ce8adf03ad031dd629c51ee0d18c
treee8d7f0195fce1e014910351f5bd5c93679ebe5d8
parentd1bb53f439bc15e4518932eb4158936d3a9d8b7b
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>
Gbp-Pq: Topic cve-2025-jan
Gbp-Pq: Name fs-Prevent-overflows-when-assigning-returned-values-from-.patch
grub-core/fs/cpio_common.c
grub-core/fs/tar.c