]> git.ipfire.org Git - thirdparty/systemd.git/commit
ordered-set: avoid overflow
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 25 Jul 2025 17:58:01 +0000 (02:58 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 25 Jul 2025 20:00:02 +0000 (05:00 +0900)
commit2c3b3e2fd9f7481ac59050ac39a93b5f0641ea4f
tree2935f75c27b55e0427002c3294ea9b94a5f1dec9
parent6ce3b1fa331f7c3e44354fe56a0ed92c33e54776
ordered-set: avoid overflow

Previously, ordered_set_put_strdupv() and friends returns the number of
pushed entries, but that is potentially larger than INT_MAX (of course,
realistically, OOM is triggered in that case).

No caller uses the number of the new entries. Let's return 1 when at
least one element is added.

Fixes CID#1611523.
src/basic/ordered-set.c
src/test/test-ordered-set.c