[syslinux] fix crash when installing syslinux on large drives

* The check for minfatsize seems erroneous, and libfat_open()
  errors weren't checked in syslinux.c anyway
* Closes #156
This commit is contained in:
Pete Batard 2013-07-05 22:26:47 +01:00
parent d81ca7de24
commit 0938c56fdc
3 changed files with 13 additions and 6 deletions

View File

@ -30,7 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.3.4.265"
CAPTION "Rufus v1.3.4.266"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -278,8 +278,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,4,265
PRODUCTVERSION 1,3,4,265
FILEVERSION 1,3,4,266
PRODUCTVERSION 1,3,4,266
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -296,13 +296,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.3.4.265"
VALUE "FileVersion", "1.3.4.266"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.3.4.265"
VALUE "ProductVersion", "1.3.4.266"
END
END
BLOCK "VarFileInfo"

View File

@ -146,7 +146,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter)
/* Reopen the volume (we already have a lock) */
d_handle = GetLogicalHandle(drive_index, TRUE, FALSE);
if (d_handle == INVALID_HANDLE_VALUE) {
uprintf("Could open volume for syslinux operation\n");
uprintf("Could open volume for Syslinux installation\n");
goto out;
}
@ -156,6 +156,10 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter)
if (sectors == NULL)
goto out;
fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
if (fs == NULL) {
uprintf("FAT access error\n");
goto out;
}
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
secp = sectors;
nsectors = 0;

View File

@ -92,10 +92,13 @@ libfat_open(int (*readfunc) (intptr_t, void *, size_t, libfat_sector_t),
} else
goto barf; /* Impossibly many clusters */
/* This check doesn't hold for Large FAT32 => remove it */
#if 0
minfatsize = (minfatsize + LIBFAT_SECTOR_SIZE - 1) >> LIBFAT_SECTOR_SHIFT;
if (minfatsize > fatsize)
goto barf; /* The FATs don't fit */
#endif
if (fs->fat_type == FAT28)
fs->rootcluster = read32(&bs->u.fat32.bpb_rootclus);