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

[iso] fix support for multi-extent files when Joliet is in use

* See https://lists.gnu.org/archive/html/libcdio-devel/2022-06/msg00000.html
* This partially fixes ISO mode support for Gentoo Live, though, since the Gentoo
  maintainers appear not to have a kernel NTFS driver in the current images, the
  installer still fails to mount the installation media.
This commit is contained in:
Thomas Schmitt 2022-06-25 11:45:15 +02:00 committed by Pete Batard
parent d457a0bafe
commit ae377ae8ca
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 73 additions and 25 deletions

View file

@ -795,6 +795,49 @@ _iso9660_is_rock_ridge_enabled(void* p_image)
return true; return true;
} }
/*!
Convert a directory record name to a 0-terminated string.
One of parameters alloc_result and cpy_result should be non-NULL to take
the result.
*/
static bool
_iso9660_recname_to_cstring(const char *src, size_t src_len,
cdio_utf8_t **alloc_result,
cdio_utf8_t *cpy_result, uint8_t u_joliet_level)
{
#ifdef HAVE_JOLIET
if (u_joliet_level) {
int i_inlen = src_len;
cdio_utf8_t *p_psz_out = NULL;
if (cdio_charset_to_utf8(src, i_inlen, &p_psz_out, "UCS-2BE")) {
if (cpy_result != NULL)
strcpy(cpy_result, p_psz_out);
if (alloc_result != NULL)
*alloc_result = p_psz_out;
else
free(p_psz_out);
} else {
return false;
}
} else
#endif /*HAVE_JOLIET*/
{
if (alloc_result != NULL) {
*alloc_result = calloc(1, src_len + 1);
if (*alloc_result == NULL)
return false;
strncpy(*alloc_result, src, src_len);
(*alloc_result)[src_len] = 0;
}
if (cpy_result != NULL) {
strncpy(cpy_result, src, src_len);
cpy_result[src_len] = 0;
}
}
return true;
}
static iso9660_stat_t * static iso9660_stat_t *
_iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir, _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir,
iso9660_stat_t *last_p_stat, iso9660_stat_t *last_p_stat,
@ -868,8 +911,17 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir,
if ((p_iso9660_dir->file_flags & ISO_MULTIEXTENT) == 0) { if ((p_iso9660_dir->file_flags & ISO_MULTIEXTENT) == 0) {
/* Check if this is the last part of a multiextent file */ /* Check if this is the last part of a multiextent file */
if (!first_extent) { if (!first_extent) {
if (strlen(p_stat->filename) != i_fname || cdio_utf8_t *p_psz_out = NULL;
strncmp(p_stat->filename, &p_iso9660_dir->filename.str[1], i_fname) != 0) { int bad_multi;
int i_inlen = i_fname;
if (!_iso9660_recname_to_cstring(&p_iso9660_dir->filename.str[1],
i_inlen, &p_psz_out, NULL,
u_joliet_level))
goto fail;
bad_multi = (strcmp(p_stat->filename, p_psz_out) != 0);
free(p_psz_out);
if (bad_multi) {
cdio_warn("Non consecutive multiextent file parts for '%s'", cdio_warn("Non consecutive multiextent file parts for '%s'",
p_stat->filename); p_stat->filename);
goto fail; goto fail;
@ -895,30 +947,26 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir,
} }
strncpy(p_stat->filename, rr_fname, i_rr_fname+1); strncpy(p_stat->filename, rr_fname, i_rr_fname+1);
} else { } else {
if ('\0' == p_iso9660_dir->filename.str[1] && 1 == i_fname) if ('\0' == p_iso9660_dir->filename.str[1] && 1 == i_fname) {
strncpy (p_stat->filename, ".", strlen(".")+1); strncpy (p_stat->filename, ".", strlen(".")+1);
else if ('\1' == p_iso9660_dir->filename.str[1] && 1 == i_fname) } else if ('\1' == p_iso9660_dir->filename.str[1] && 1 == i_fname) {
strncpy (p_stat->filename, "..", strlen("..")+1); strncpy (p_stat->filename, "..", strlen("..")+1);
#ifdef HAVE_JOLIET
else if (u_joliet_level) {
int i_inlen = i_fname;
cdio_utf8_t *p_psz_out = NULL;
if (cdio_charset_to_utf8(&p_iso9660_dir->filename.str[1], i_inlen,
&p_psz_out, "UCS-2BE")) {
strncpy(p_stat->filename, p_psz_out, i_fname);
free(p_psz_out);
} else { } else {
int i_inlen = i_fname;
if (!_iso9660_recname_to_cstring(&p_iso9660_dir->filename.str[1],
i_inlen, NULL, p_stat->filename,
u_joliet_level))
goto fail; goto fail;
} }
} }
#endif /*HAVE_JOLIET*/
else {
strncpy (p_stat->filename, &p_iso9660_dir->filename.str[1], i_fname);
}
}
} else { } else {
/* Use the plain ISO-9660 name when dealing with a multiextent file part */ int i_inlen = i_fname;
strncpy(p_stat->filename, &p_iso9660_dir->filename.str[1], i_fname);
if (!_iso9660_recname_to_cstring(&p_iso9660_dir->filename.str[1],
i_inlen, NULL, p_stat->filename,
u_joliet_level))
goto fail;
} }
iso9660_get_dtime(&(p_iso9660_dir->recording_time), true, &(p_stat->tm)); iso9660_get_dtime(&(p_iso9660_dir->recording_time), true, &(p_stat->tm));

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
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 3.19.1907" CAPTION "Rufus 3.19.1908"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,19,1907,0 FILEVERSION 3,19,1908,0
PRODUCTVERSION 3,19,1907,0 PRODUCTVERSION 3,19,1908,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.19.1907" VALUE "FileVersion", "3.19.1908"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.19.exe" VALUE "OriginalFilename", "rufus-3.19.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.19.1907" VALUE "ProductVersion", "3.19.1908"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"