]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: (hfs) fix label use [fuzzing]
authorKarel Zak <kzak@redhat.com>
Thu, 2 Jun 2022 14:02:54 +0000 (16:02 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Jul 2022 15:49:33 +0000 (17:49 +0200)
Reported-by: Thibault Guittet <tguittet@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/hfs.c

index ebf90e49e6ebfd92e5359b19257f63c1d2142761..fceab95a17543134e3a0633a50345c1615af4e32 100644 (file)
@@ -173,7 +173,10 @@ static int probe_hfs(blkid_probe pr, const struct blkid_idmag *mag)
 
        hfs_set_uuid(pr, hfs->finder_info.id, sizeof(hfs->finder_info.id));
 
-       blkid_probe_set_label(pr, hfs->label, hfs->label_len);
+       size = hfs->label_len;
+       if ((size_t) size > sizeof(hfs->label))
+               size = sizeof(hfs->label);
+       blkid_probe_set_label(pr, hfs->label, size);
        return 0;
 }