From 32b2f4c01ea739bda4d616737448a58e6c9b59bc Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 27 Aug 2024 15:27:08 +0200 Subject: [PATCH] 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. --- src/shared/image-policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, "+"); -- 2.47.3