]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
image-policy: Fix size assertion
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 27 Aug 2024 13:27:08 +0000 (15:27 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 30 Aug 2024 10:13:05 +0000 (12:13 +0200)
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

index 914dd0803911770c66dc4ae43bc5e5e9d9fcc983..1fb24138fb4abf5bef4d7ab5c6b0cd479906e9fa 100644 (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, "+");