]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: tighten assertion checks on verity data
authorLennart Poettering <lennart@poettering.net>
Wed, 8 Sep 2021 15:28:37 +0000 (17:28 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Sep 2021 12:15:18 +0000 (14:15 +0200)
src/shared/dissect-image.c

index 20eade5a2a286ea50f3de6c8786ac98785d5af9d..8d5c7e08e353d87f64e8e29ae5c6c23c8de0ea83 100644 (file)
@@ -638,7 +638,10 @@ int dissect_image(
 
         assert(fd >= 0);
         assert(ret);
+        assert(!verity || verity->designator < 0 || IN_SET(verity->designator, PARTITION_ROOT, PARTITION_USR));
         assert(!verity || verity->root_hash || verity->root_hash_size == 0);
+        assert(!verity || verity->root_hash_sig || verity->root_hash_sig_size == 0);
+        assert(!verity || (verity->root_hash || !verity->root_hash_sig));
         assert(!((flags & DISSECT_IMAGE_GPT_ONLY) && (flags & DISSECT_IMAGE_NO_PARTITION_TABLE)));
 
         /* Probes a disk image, and returns information about what it found in *ret.