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>
(cherry picked from commit
05ce62bca993c260af6478a1f2035bb0c73050a9)