image-policy: Fix size assertion

We're going to write a null pointer to l[m] so we need to make sure
m is smaller than the size of the array, not m + 1.
This commit is contained in:
Daan De Meyer
2024-08-27 15:27:08 +02:00
parent 11781f37ac
commit 32b2f4c01e

View File

@@ -437,7 +437,7 @@ int partition_policy_flags_to_string(PartitionPolicyFlags flags, bool simplify,
if (m == 0)
buf = strdup("-");
else {
assert(m+1 < ELEMENTSOF(l));
assert(m < ELEMENTSOF(l));
l[m] = NULL;
buf = strv_join((char**) l, "+");