From: Daan De Meyer Date: Tue, 27 Aug 2024 13:27:08 +0000 (+0200) Subject: image-policy: Fix size assertion X-Git-Tag: v257-rc1~570^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32b2f4c01ea739bda4d616737448a58e6c9b59bc;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/shared/image-policy.c b/src/shared/image-policy.c index 914dd080391..1fb24138fb4 100644 --- a/src/shared/image-policy.c +++ b/src/shared/image-policy.c @@ -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, "+");