]> dgit.raspbian.org Git - grub2.git/commit
commands/test: Stack overflow due to unlimited recursion depth
authorLidong Chen <lidong.chen@oracle.com>
Mon, 16 Dec 2024 20:22:41 +0000 (20:22 +0000)
committerAurelien Jarno <aurel32@debian.org>
Thu, 30 Apr 2026 19:02:01 +0000 (21:02 +0200)
commit5ee4bd2c7b8524f857d03ad63cd16929cfecf20a
tree9b16dc7c8b9c64fdeb63cd962baa4c3b5294e426
parent49af4c3295d1e574b5a920182dfc91d95d3863cf
commands/test: Stack overflow due to unlimited recursion depth

The test_parse() evaluates test expression recursively. Due to lack of
recursion depth check a specially crafted expression may cause a stack
overflow. The recursion is only triggered by the parentheses usage and
it can be unlimited. However, sensible expressions are unlikely to
contain more than a few parentheses. So, this patch limits the recursion
depth to 100, which should be sufficient.

Reported-by: Nils Langius <nils@langius.de>
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 commands-test-Stack-overflow-due-to-unlimited-recursion-d.patch
grub-core/commands/test.c