mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[iso] fix a libcdio memleak for RR symlinks
* Also handle symlinks more gracefully by telling the user that they are ignored * Also tell the user which extensions will be used on extraction
This commit is contained in:
parent
417d3abe58
commit
1757e6f081
4 changed files with 33 additions and 13 deletions
27
src/iso.c
27
src/iso.c
|
@ -345,7 +345,7 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
|
|||
{
|
||||
HANDLE file_handle = NULL;
|
||||
DWORD buf_size, wr_size, err;
|
||||
BOOL s, is_syslinux_cfg, is_old_c32[NB_OLD_C32];
|
||||
BOOL s, is_syslinux_cfg, is_old_c32[NB_OLD_C32], is_symlink;
|
||||
int i_length, r = 1;
|
||||
char tmp[128], psz_fullpath[1024], *psz_basename;
|
||||
const char *psz_iso_name = &psz_fullpath[strlen(psz_extract_dir)];
|
||||
|
@ -379,10 +379,18 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
|
|||
|| (strcmp(p_statbuf->filename, "..") == 0) )
|
||||
continue;
|
||||
// Rock Ridge requires an exception
|
||||
is_symlink = FALSE;
|
||||
if ((p_statbuf->rr.b3_rock == yep) && enable_rockridge) {
|
||||
safe_strcpy(psz_basename, sizeof(psz_fullpath)-i_length-1, p_statbuf->filename);
|
||||
if (safe_strlen(p_statbuf->filename) > 64)
|
||||
iso_report.has_long_filename = TRUE;
|
||||
// libcdio has a memleak for Rock Ridge symlinks. It doesn't look like there's an easy fix there as
|
||||
// a generic list that's unaware of RR extensions is being used, so we prevent that memleak ourselves
|
||||
is_symlink = (p_statbuf->rr.psz_symlink != NULL);
|
||||
if (is_symlink)
|
||||
iso_report.has_symlinks = TRUE;
|
||||
if (scan_only)
|
||||
safe_free(p_statbuf->rr.psz_symlink);
|
||||
} else {
|
||||
iso9660_name_translate_ext(p_statbuf->filename, psz_basename, i_joliet_level);
|
||||
}
|
||||
|
@ -419,6 +427,11 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
|
|||
continue;
|
||||
if (sanitize_filename(psz_fullpath))
|
||||
uprintf(" File name sanitized to '%s'\n", psz_fullpath);
|
||||
if (is_symlink) {
|
||||
if (i_file_length == 0)
|
||||
uprintf(" Ignoring Rock Ridge symbolic link to '%s'\n", p_statbuf->rr.psz_symlink);
|
||||
safe_free(p_statbuf->rr.psz_symlink);
|
||||
}
|
||||
file_handle = CreateFileU(psz_fullpath, GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (file_handle == INVALID_HANDLE_VALUE) {
|
||||
|
@ -544,9 +557,9 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan)
|
|||
|
||||
try_iso:
|
||||
// Perform our first scan with Joliet disabled (if Rock Ridge is enabled), so that we can find if
|
||||
// there exists a Rock Ridge file with a name > 64 chars. If that is the case (has_long_filename)
|
||||
// then we also disable Joliet during the extract phase.
|
||||
if ((!enable_joliet) || (scan_only && enable_rockridge) || (iso_report.has_long_filename && enable_rockridge)) {
|
||||
// there exists a Rock Ridge file with a name > 64 chars or if there are symlinks. If that is the
|
||||
// case then we also disable Joliet during the extract phase.
|
||||
if ((!enable_joliet) || (enable_rockridge && (scan_only || iso_report.has_long_filename || iso_report.has_symlinks))) {
|
||||
iso_extension_mask &= ~ISO_EXTENSION_JOLIET;
|
||||
}
|
||||
if (!enable_rockridge) {
|
||||
|
@ -567,6 +580,12 @@ try_iso:
|
|||
safe_free(tmp);
|
||||
} else
|
||||
iso_report.label[0] = 0;
|
||||
} else {
|
||||
if (iso_extension_mask & (ISO_EXTENSION_JOLIET|ISO_EXTENSION_ROCK_RIDGE))
|
||||
uprintf("This image will be extracted using %s extensions (if present)",
|
||||
(iso_extension_mask & ISO_EXTENSION_JOLIET)?"Joliet":"Rock Ridge");
|
||||
else
|
||||
uprintf("This image will not be extracted using any ISO extensions");
|
||||
}
|
||||
r = iso_extract_files(p_iso, "");
|
||||
|
||||
|
|
|
@ -1242,10 +1242,10 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
if (HAS_SYSLINUX(iso_report)) {
|
||||
safe_sprintf(isolinux_str, sizeof(isolinux_str), "Yes (%s)", iso_report.sl_version_str);
|
||||
}
|
||||
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >64 chars filename: %s\r\n Has a >4GB file: %s\r\n"
|
||||
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >64 chars filename: %s\r\n Has Symlinks: %s\r\n Has a >4GB file: %s\r\n"
|
||||
" ReactOS: %s\r\n Uses EFI: %s%s\r\n Uses Bootmgr: %s\r\n Uses WinPE: %s%s\r\n Uses isolinux: %s\r\n",
|
||||
iso_report.label, iso_report.projected_size, iso_report.has_long_filename?"Yes":"No", iso_report.has_4GB_file?"Yes":"No",
|
||||
IS_REACTOS(iso_report)?"Yes":"No", (iso_report.has_efi || iso_report.has_win7_efi)?"Yes":"No",
|
||||
iso_report.label, iso_report.projected_size, iso_report.has_long_filename?"Yes":"No", iso_report.has_symlinks?"Yes":"No",
|
||||
iso_report.has_4GB_file?"Yes":"No", IS_REACTOS(iso_report)?"Yes":"No", (iso_report.has_efi || iso_report.has_win7_efi)?"Yes":"No",
|
||||
(iso_report.has_win7_efi && (!iso_report.has_efi))?" (win7_x64)":"", iso_report.has_bootmgr?"Yes":"No",
|
||||
IS_WINPE(iso_report.winpe)?"Yes":"No", (iso_report.uses_minint)?" (with /minint)":"", isolinux_str);
|
||||
if (HAS_SYSLINUX(iso_report) && (SL_MAJOR(iso_report.sl_version) < 5)) {
|
||||
|
|
|
@ -235,6 +235,7 @@ typedef struct {
|
|||
uint8_t winpe;
|
||||
BOOL has_4GB_file;
|
||||
BOOL has_long_filename;
|
||||
BOOL has_symlinks;
|
||||
BOOL has_bootmgr;
|
||||
BOOL has_efi;
|
||||
BOOL has_win7_efi;
|
||||
|
|
12
src/rufus.rc
12
src/rufus.rc
|
@ -32,7 +32,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
|
||||
CAPTION "Rufus 1.4.4.407"
|
||||
CAPTION "Rufus 1.4.4.408"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
|
||||
|
@ -165,7 +165,7 @@ END
|
|||
RTL_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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
|
||||
CAPTION "Rufus 1.4.4.407"
|
||||
CAPTION "Rufus 1.4.4.408"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
|
||||
|
@ -427,8 +427,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,4,4,407
|
||||
PRODUCTVERSION 1,4,4,407
|
||||
FILEVERSION 1,4,4,408
|
||||
PRODUCTVERSION 1,4,4,408
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -445,13 +445,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.4.4.407"
|
||||
VALUE "FileVersion", "1.4.4.408"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "1.4.4.407"
|
||||
VALUE "ProductVersion", "1.4.4.408"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue