]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: cover BCD offsets past the buffer
authordongshengyuan <545258830@qq.com>
Fri, 17 Jul 2026 02:44:03 +0000 (10:44 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 19 Jul 2026 11:21:47 +0000 (20:21 +0900)
Add a zero-length test for offset > max so the first bounds guard
is covered separately from the length overflow check.

Follow-up: 231857cfe8da749925ee2beb1352e74fa96f1372

src/boot/test-bcd.c

index d6e307b6ecf2622564588cfd8cbbdad9a9cbdc65..6d9603dd78a8076153250f1156ae7360a710ca5f 100644 (file)
@@ -96,6 +96,7 @@ TEST(offset_bounds) {
         assert_se(!BAD_ARRAY(Key, key_name, 0, 0, sizeof(Key)));
 
         assert_se(bad_offset(0, sizeof(Key) + 1, sizeof(Key)));
+        assert_se(bad_offset(sizeof(Key) + 1, 0, sizeof(Key)));
         assert_se(bad_offset(UINT32_MAX, 2, UINT32_MAX));
 }