diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-01-31 15:31:19 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-01-31 15:31:23 +0100 |
commit | 020313b213f0eb9184bbe17bb9507157350cc9e0 (patch) | |
tree | 23be73b45eec117d206c209df77522887113a11e /src/test | |
parent | user-util: fix use after free() on error path (diff) | |
download | systemd-020313b213f0eb9184bbe17bb9507157350cc9e0.tar.xz systemd-020313b213f0eb9184bbe17bb9507157350cc9e0.zip |
test: also check the result of merge_gid_lists()
Fixes CID#1412354.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-user-util.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/test-user-util.c b/src/test/test-user-util.c index 6bfe7dc7e1..084a584876 100644 --- a/src/test/test-user-util.c +++ b/src/test/test-user-util.c @@ -310,15 +310,19 @@ static void test_gid_lists_ops(void) { int nresult; nresult = merge_gid_lists(l2, ELEMENTSOF(l2), l3, ELEMENTSOF(l3), &res1); + assert_se(nresult >= 0); assert_se(memcmp_nn(res1, nresult, result1, ELEMENTSOF(result1)) == 0); nresult = merge_gid_lists(NULL, 0, l2, ELEMENTSOF(l2), &res2); + assert_se(nresult >= 0); assert_se(memcmp_nn(res2, nresult, l2, ELEMENTSOF(l2)) == 0); nresult = merge_gid_lists(l1, ELEMENTSOF(l1), l1, ELEMENTSOF(l1), &res3); + assert_se(nresult >= 0); assert_se(memcmp_nn(l1, ELEMENTSOF(l1), res3, nresult) == 0); nresult = merge_gid_lists(l1, ELEMENTSOF(l1), l4, ELEMENTSOF(l4), &res4); + assert_se(nresult >= 0); assert_se(memcmp_nn(result2, ELEMENTSOF(result2), res4, nresult) == 0); nresult = getgroups_alloc(&gids); |