Hi Heinrich, On Sun, 1 Nov 2026 at 09:03, Heinrich Schuchardt <[email protected]> wrote: >> + ut_asserteq_str("00000000-100", disk_partition_uuid(&info)); > > Linux include/linux/blkdev.h has: > > "MSDOS UUID is 11 characters." > So this change looks wrong.
You're right. Linux never numbers a partition above 255: the partition parsers stop at DISK_MAX_PARTS - 1 (parse_extended() stops as soon as state->next reaches state->limit) and add_partition() refuses a higher number. So the "%08x-%02x" UUID it makes up for a DOS partition always has 11 characters, and a "-100" one could never match a Linux PARTUUID anyway. The bug is rather that part_dos.c numbers partitions past that: MAX_EXT_PARTS is 256, and it is only checked once per table, so the entries of the last table read can take part_num up to 259 and overflow the 12-byte buffer. So in v4 I'll leave the buffer and the sprintf() as they are, and instead lower MAX_EXT_PARTS to 255 and check it before each entry, in both walks (part_get_info_extended() and print_partition_extended()), as parse_extended() does. The test then checks that partition 255 gets "00000000-ff" and that there is no partition 256, both when looking a partition up and when listing them. The patch becomes "disk: part_dos: Number at most 255 partitions, as Linux does", and I'll drop Simon's Reviewed-by from it since it has changed. I'll wait a few days for comments on the rest of the series before sending v4. Thanks, Ana
