[syslinux] fix a crash if the downloaded Syslinux content has been modified

* Some stupid corporate firewalls will return garbage content for ldlinux.bss/ldlinux.sys
  instead of a 403 (as they really should), which creates an issue with the code written
  by the Syslinux people, as they forgot to check for potential overflows...
This commit is contained in:
Pete Batard 2015-10-28 23:17:55 +00:00
parent c12977a164
commit ad68ccfac9
3 changed files with 13 additions and 8 deletions

View file

@ -122,7 +122,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
sectbuf = malloc(SECTOR_SIZE);
if (sectbuf == NULL)
goto out;
/* Initialize the ADV -- this should be smarter */
syslinux_reset_adv(syslinux_adv);
@ -262,7 +262,10 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
}
/* Patch ldlinux.sys and the boot sector */
syslinux_patch(sectors, nsectors, 0, 0, NULL, NULL);
if (syslinux_patch(sectors, nsectors, 0, 0, NULL, NULL) < 0) {
uprintf("Could not patch Syslinux files");
goto out;
}
/* Rewrite the file */
if (SetFilePointer(f_handle, 0, NULL, FILE_BEGIN) != 0 ||