]> 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>
Thu, 2 Jun 2022 14:13:27 +0000 (16:13 +0200)
Reported-by: Thibault Guittet <tguittet@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/hfs.c

index 9674b1481f572e4274653c3c923db68b06121272..68cb30edbbe14840e7226d78bf02b1ffd177fc48 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;
 }