[syslinux] chain.c32 memcmp bug

Szymon H bodwick at gmail.com
Sun Mar 13 16:13:15 PDT 2011


Hello,

I've noticed that finding disks by guid using chain.c32 from both 4.03
and latest 4.04 pre12 doesn't work as expected (unable to find
requested GPT disk/partition). The entered guid is correct according
to gdisk and chain.c32 debug information but still chain.c32 claims it
can't find the drive.

The bug is located in function find_by_guid, line 991. It is
is_me = !memcmp(&header->disk_guid, &gpt_guid, sizeof(*gpt_guid));
but should be
is_me = !memcmp(&header->disk_guid, gpt_guid, sizeof(*gpt_guid));
as memcmp takes two void pointers and gpt_guid is already a pointer to
struct guid.

I've recompiled chain.c32 with this tiny fix (using gcc 4.4.3) and now
it finds disks by guid fine.

Best regards,
Simon




More information about the Syslinux mailing list