[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) {
uprintf("Could not download the file - cancelling\n");
return FALSE;
// If the version matches our embedded one, try to use that as a last ditch effort
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
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.8.880"
CAPTION "Rufus 2.8.881"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -320,8 +320,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,8,880,0
PRODUCTVERSION 2,8,880,0
FILEVERSION 2,8,881,0
PRODUCTVERSION 2,8,881,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -338,13 +338,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.8.880"
VALUE "FileVersion", "2.8.881"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.8.880"
VALUE "ProductVersion", "2.8.881"
END
END
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 */
/* Search for LDLINUX_MAGIC to find the patch area */
for (wp = (const uint32_t _slimg *)boot_image;
(get_32_sl(wp) != LDLINUX_MAGIC) && (((uintptr_t)wp) < ((uintptr_t)boot_image + boot_image_len));
wp++)
;
if (((uintptr_t)wp) >= ((uintptr_t)boot_image + boot_image_len))
dw = (boot_image_len - sizeof(struct patch_area)) >> 2;
for (i = 0, wp = (const uint32_t _slimg *)boot_image;
(i <= dw) && ((get_32_sl(wp) != LDLINUX_MAGIC));
i++, wp++)
if (i > dw) /* Not found */
return -1;
patcharea = (struct patch_area _slimg *)wp;
epa = slptr(boot_image, &patcharea->epaoffset);