From 0a24940c85948e546326a5536ce14cf136b1cc64 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 12 Sep 2019 13:18:29 +0100 Subject: [PATCH] [iso] fix detection of 'txt.cfg' as a main Syslinux config file * While we need to detect that 'txt.cfg' is a Syslinux config file, so that we can alter it for persistence, it should never be used as a main config file, such as the one we link to when we create /syslinux.cfg. * Closes #1375 --- src/iso.c | 17 +++++++++-------- src/rufus.rc | 10 +++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/iso.c b/src/iso.c index 9926807d..fc06dbdd 100644 --- a/src/iso.c +++ b/src/iso.c @@ -87,7 +87,8 @@ static const char* wininst_name[] = { "install.wim", "install.esd", "install.swm static const char* grub_dirname = "/boot/grub/i386-pc"; static const char* grub_cfg = "grub.cfg"; static const char* menu_cfg = "menu.cfg"; -static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "txt.cfg", "extlinux.conf" }; +// NB: Do not alter the order of the array below without validating hardcoded indexes in check_iso_props +static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf", "txt.cfg" }; static const char* isolinux_bin[] = { "isolinux.bin", "boot.bin" }; static const char* pe_dirname[] = { "/i386", "/amd64", "/minint" }; static const char* pe_file[] = { "ntdetect.com", "setupldr.bin", "txtsetup.sif" }; @@ -151,19 +152,23 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const const char* psz_fullpath, EXTRACT_PROPS *props) { size_t i, j, len; + // Check for an isolinux/syslinux config file anywhere memset(props, 0, sizeof(EXTRACT_PROPS)); - for (i=0; iis_cfg = TRUE; // Required for "extlinux.conf" props->is_syslinux_cfg = TRUE; + // Maintain a list of all the isolinux/syslinux config files identified so far + if ((scan_only) && (i < 3)) + StrArrayAdd(&config_path, psz_fullpath, TRUE); if ((scan_only) && (i == 1) && (safe_stricmp(psz_dirname, efi_dirname) == 0)) img_report.has_efi_syslinux = TRUE; } } // Check for an old incompatible c32 file anywhere - for (i=0; iis_old_c32[i] = TRUE; } @@ -262,10 +267,6 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const if (safe_stricmp(psz_basename, pe_file[j]) == 0) img_report.winpe |= (1<is_syslinux_cfg) { - // Maintain a list of all the isolinux/syslinux configs identified so far - StrArrayAdd(&config_path, psz_fullpath, TRUE); - } for (i=0; i