]> git.ipfire.org Git - thirdparty/grub.git/commit
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)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 13 Feb 2025 14:45:58 +0000 (15:45 +0100)
commit5b36a5210e21bee2624f8acc36aefd8f10266adb
tree5fa2b67fcb4437f295bb48bc671ed1528c86a676
parent9907d9c2723304b42cf6da74f1cc6c4601391956
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>
grub-core/normal/menu.c