normal/menu: Use safe math to avoid an integer overflow
authorAlec Brown <alec.r.brown@oracle.com>
Tue, 4 Feb 2025 15:11:11 +0000 (15:11 +0000)
committerFelix Zielcke <fzielcke@z-51.de>
Wed, 11 Jun 2025 15:42:34 +0000 (17:42 +0200)
commit3c966b068a08d66cd2cf5f5271c24b2edd3a38bc
treec9eb07d484c696886acc0d470f07fa37c6eaf7ff
parent7d208933e45fe6153d0815e0c86dec67fb7d5b2b
normal/menu: Use safe math to avoid an integer overflow

The Coverity indicates that the variable current_entry might overflow.
To prevent this use safe math when adding GRUB_MENU_PAGE_SIZE to current_entry.

On the occasion fix limiting condition which was broken.

Fixes: CID 473853
Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Gbp-Pq: Topic cve-2025-jan
Gbp-Pq: Name normal-menu-Use-safe-math-to-avoid-an-integer-overflow.patch
grub-core/normal/menu.c