From ea4eb902812de248249b27599ef0678492d29128 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 2 Jun 2022 16:02:54 +0200 Subject: [PATCH] libblkid: (hfs) fix label use [fuzzing] Reported-by: Thibault Guittet Signed-off-by: Karel Zak --- libblkid/src/superblocks/hfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libblkid/src/superblocks/hfs.c b/libblkid/src/superblocks/hfs.c index ebf90e49e6..fceab95a17 100644 --- a/libblkid/src/superblocks/hfs.c +++ b/libblkid/src/superblocks/hfs.c @@ -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; } -- 2.47.2