[syslinux] crash in extlinux/main

Jur van der Burg jur at digiater.nl
Sat Jul 16 06:10:35 PDT 2011


Hi,

I found a bug in extlinux/main.c. Writing a bootloader on a file mounted via
/dev/mapper in Lunix it crashed on me with a segment fault.

The bug is here:

     if (!ioctl(devfd, HDIO_GETGEO, &geo)) {

Since we are already called with geo as a pointer the & is wrong as the
pointer itself will be overwritten.

This works:

int get_geometry(int devfd, uint64_t totalbytes, struct hd_geometry *geo)
{
     struct floppy_struct fd_str;
     struct loop_info li;
     struct loop_info64 li64;
     const struct geometry_table *gp;
     int rv = 0;

     memset(geo, 0, sizeof *geo);

     if (!ioctl(devfd, HDIO_GETGEO, geo)) {
	goto ok;


If someone can incorporate this in a future version I would be happy.

V4.03 and V4.04 have the same issue, I did not look at another version.

Jur van der Burg.




More information about the Syslinux mailing list