]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: ntfs: improve integer overflow checks
authorKarel Zak <kzak@redhat.com>
Wed, 15 Apr 2026 13:20:47 +0000 (15:20 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 23 Apr 2026 12:07:44 +0000 (14:07 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/ntfs.c

index 8ce557a113c1158aba0c9b86155f66faace3bdfa..c7b8fe496cffe9ac1112c5af6c70f6400cd8a386 100644 (file)
@@ -206,7 +206,8 @@ static int __probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag, int save_
                        unsigned int val_len = le32_to_cpu(attr->value_len);
                        unsigned char *val = ((uint8_t *) attr) + val_off;
 
-                       if (attr_off + val_off + val_len <= mft_record_size)
+                       if (val_off <= mft_record_size - attr_off &&
+                           val_len <= mft_record_size - attr_off - val_off)
                                blkid_probe_set_utf8label(pr, val, val_len,
                                                          UL_ENCODE_UTF16LE);
                        break;