1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[syslinux] fallback to embedded on version match if download fails

* Could be useful for current tails user (6.03 based, same as ours)
  who want to create an UFD without downloading files.
* Also improve the buffer overflow check in syslinux/libinstaller/syslxmod.c
This commit is contained in:
Pete Batard 2016-03-08 17:28:45 +00:00
parent 1cc7fca4c5
commit a10a207790
3 changed files with 17 additions and 12 deletions

View file

@ -1468,8 +1468,13 @@ static BOOL BootCheck(void)
} }
} }
if (syslinux_ldlinux_len[i] == 0) { if (syslinux_ldlinux_len[i] == 0) {
uprintf("Could not download the file - cancelling\n"); // If the version matches our embedded one, try to use that as a last ditch effort
return FALSE; if (img_report.sl_version == embedded_sl_version[1]) {
uprintf("Could not download the file - will try to use embedded %s version instead", img_report.sl_version_str);
} else {
uprintf("Could not download the file - cancelling\n");
return FALSE;
}
} }
} }
} }

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.8.880" CAPTION "Rufus 2.8.881"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -320,8 +320,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,8,880,0 FILEVERSION 2,8,881,0
PRODUCTVERSION 2,8,880,0 PRODUCTVERSION 2,8,881,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -338,13 +338,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.8.880" VALUE "FileVersion", "2.8.881"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.8.880" VALUE "ProductVersion", "2.8.881"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -122,11 +122,11 @@ int syslinux_patch(const sector_t *sectp, int nsectors,
return -1; /* The actual file is too small for content */ return -1; /* The actual file is too small for content */
/* Search for LDLINUX_MAGIC to find the patch area */ /* Search for LDLINUX_MAGIC to find the patch area */
for (wp = (const uint32_t _slimg *)boot_image; dw = (boot_image_len - sizeof(struct patch_area)) >> 2;
(get_32_sl(wp) != LDLINUX_MAGIC) && (((uintptr_t)wp) < ((uintptr_t)boot_image + boot_image_len)); for (i = 0, wp = (const uint32_t _slimg *)boot_image;
wp++) (i <= dw) && ((get_32_sl(wp) != LDLINUX_MAGIC));
; i++, wp++)
if (((uintptr_t)wp) >= ((uintptr_t)boot_image + boot_image_len)) if (i > dw) /* Not found */
return -1; return -1;
patcharea = (struct patch_area _slimg *)wp; patcharea = (struct patch_area _slimg *)wp;
epa = slptr(boot_image, &patcharea->epaoffset); epa = slptr(boot_image, &patcharea->epaoffset);