]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: f2fs: ensure checksum offset is within superblock
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 18 Sep 2022 18:14:47 +0000 (20:14 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 18 Sep 2022 18:18:12 +0000 (20:18 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libblkid/src/superblocks/f2fs.c

index 65384b9f73e478bb43580265dfbb21ef3678c3b9..3a2924d9105e041bc7246d1ec49a352df51f66cc 100644 (file)
@@ -62,6 +62,8 @@ static int f2fs_validate_checksum(blkid_probe pr, size_t sb_off,
        uint32_t csum_off = le32_to_cpu(sb->checksum_offset);
        if (!csum_off)
                return 1;
+       if (csum_off + sizeof(uint32_t) > 4096)
+               return 0;
 
        unsigned char *csum_data = blkid_probe_get_buffer(pr,
                        sb_off + csum_off, sizeof(uint32_t));