]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
src/lex.l: fix pointer overflow in yylex() main
authorАлександр Ушаков <aushakov@astralinux.ru>
Mon, 28 Jul 2025 10:23:12 +0000 (13:23 +0300)
committerKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 14 Aug 2025 11:24:54 +0000 (16:54 +0530)
commit05ce62bca993c260af6478a1f2035bb0c73050a9
tree16f67051f6d9635b43e3d95c105bdd8d3fdf8c6f
parent88fc455b8d0df20910ee2f8e90eb90a4752bd986
src/lex.l: fix pointer overflow in yylex()

UBSAN reported a pointer overflow bug when a fuzz test passed empty
strings to cgroup_init_templates_cache(). The issue is triggered by
the strlen(yylval.name - 1) check, which returns a negative value.
This value is then implicitly cast to an unsigned long long, causing
incorrect behavior. Fix this by adding checks for empty strings inputs.

This issue was discovered while running fuzz tests using the Clang
compiler.

[Kamalesh added commit message]
Signed-off-by: Aleksandr Ushakov <aushakov@astralinux.ru>
Acked-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
src/lex.l