]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
src: handle NULL options in cgroup_parse_rules_options
authorSam James <sam@gentoo.org>
Fri, 23 May 2025 00:13:51 +0000 (01:13 +0100)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 23 May 2025 15:59:33 +0000 (09:59 -0600)
commit0e4cf074c6deffe42de04100fa4993ab189e6163
treeef8cf9e5f610845be55a6d79e86384459acf86f5
parent565c13c49e4511daefa75fb00a6b8695e903019b
src: handle NULL options in cgroup_parse_rules_options

We don't want to pass NULL to strtok:
```
[ RUN      ] ParseRulesOptionsTest.RulesOptions_NullOptions
==2006496== Conditional jump or move depends on uninitialised value(s)
==2006496==    at 0x520D156: strtok_r (strtok_r.c:49)
==2006496==    by 0x403FB7E: cgroup_parse_rules_options (api.c:529)
==2006496==    by 0x4005F41: ParseRulesOptionsTest_RulesOptions_NullOptions_Test::TestBody() (002-cgroup_parse_rules_options.cpp:89)
==2006496==    by 0x4ABA45D: ??? (in /usr/lib64/libgtest.so.1.15.2)
==2006496==    by 0x4ABE5AB: ??? (in /usr/lib64/libgtest.so.1.15.2)
==2006496==    by 0x4A9D949: testing::TestInfo::Run() (in /usr/lib64/libgtest.so.1.15.2)
==2006496==    by 0x4ABF18A: ??? (in /usr/lib64/libgtest.so.1.15.2)
==2006496==    by 0x4AB7467: testing::internal::UnitTestImpl::RunAllTests() (in /usr/lib64/libgtest.so.1.15.2)
==2006496==    by 0x4AACC46: testing::UnitTest::Run() (in /usr/lib64/libgtest.so.1.15.2)
==2006496==    by 0x4002345: UnknownInlinedFun (gtest.h:2334)
==2006496==    by 0x4002345: main (gtest.cpp:15)
==2006496==
Error: failed to parse options: (null)
```

Signed-off-by: Sam James <sam@gentoo.org>
Acked-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 42cee67adb5415abd0206f8ca0780296716588d1)
src/api.c