diff --git a/src/libcdio/cdio/rock.h b/src/libcdio/cdio/rock.h index 33774c7a..548228bf 100644 --- a/src/libcdio/cdio/rock.h +++ b/src/libcdio/cdio/rock.h @@ -98,23 +98,23 @@ PRAGMA_BEGIN_PACKED /*! system-use-sharing protocol */ typedef struct iso_su_sp_s{ - unsigned char magic[2]; + uint8_t magic[2]; uint8_t skip; } GNUC_PACKED iso_su_sp_t; /*! system-use extension record */ typedef struct iso_su_er_s { iso711_t len_id; /**< Identifier length. Value 10?. */ - unsigned char len_des; - unsigned char len_src; + uint8_t len_des; + uint8_t len_src; iso711_t ext_ver; /**< Extension version. Value 1? */ - char data[EMPTY_ARRAY_SIZE]; + char data[EMPTY_ARRAY_SIZE]; } GNUC_PACKED iso_su_er_t; typedef struct iso_su_ce_s { - char extent[8]; - char offset[8]; - char size[8]; + uint8_t extent[8]; + uint8_t offset[8]; + uint8_t size[8]; } iso_su_ce_t; /*! POSIX file attributes, PX. See Rock Ridge Section 4.1.2 */ @@ -165,7 +165,7 @@ typedef struct iso_rock_sl_part_s { /*! Symbolic link. See Rock Ridge Section 4.1.3 */ typedef struct iso_rock_sl_s { - unsigned char flags; + uint8_t flags; iso_rock_sl_part_t link; } GNUC_PACKED iso_rock_sl_t ; @@ -184,7 +184,7 @@ typedef enum { typedef struct iso_rock_nm_s { - unsigned char flags; + uint8_t flags; char name[EMPTY_ARRAY_SIZE]; } GNUC_PACKED iso_rock_nm_t ; diff --git a/src/libcdio/iso9660/rock.c b/src/libcdio/iso9660/rock.c index a957d785..d2c01165 100644 --- a/src/libcdio/iso9660/rock.c +++ b/src/libcdio/iso9660/rock.c @@ -1,6 +1,6 @@ /* - Copyright (C) 2020 Pete Batard - Copyright (C) 2005, 2008, 2010-2011, 2014, 2017 Rocky Bernstein + Copyright (C) 2020, 2023 Pete Batard + Copyright (C) 2005, 2008, 2010-2011, 2014, 2017, 2022 Rocky Bernstein Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale @@ -94,34 +94,36 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow) /* This is a way of ensuring that we have something in the system use fields that is compatible with Rock Ridge */ -#define CHECK_SP(FAIL) \ - if(rr->u.SP.magic[0] != 0xbe) FAIL; \ - if(rr->u.SP.magic[1] != 0xef) FAIL; \ +#define CHECK_SP(FAIL) \ + if (rr->u.SP.magic[0] != 0xbe) FAIL; \ + if (rr->u.SP.magic[1] != 0xef) FAIL; \ p_stat->rr.s_rock_offset = rr->u.SP.skip; /* We define a series of macros because each function must do exactly the same thing in certain places. We use the macros to ensure that everything is done correctly */ #define CONTINUE_DECLS \ - int cont_extent = 0, cont_offset = 0, cont_size = 0; \ - void *buffer = NULL + uint32_t cont_extent = 0, cont_offset = 0, cont_size = 0; \ + uint8_t *buffer = NULL -#define CHECK_CE \ - { cont_extent = from_733(*rr->u.CE.extent); \ - cont_offset = from_733(*rr->u.CE.offset); \ - cont_size = from_733(*rr->u.CE.size); \ - (void)cont_extent; (void)cont_offset, (void)cont_size; } +#define CHECK_CE(FAIL) \ + { cont_extent = from_733(*rr->u.CE.extent); \ + cont_offset = from_733(*rr->u.CE.offset); \ + if (cont_offset >= ISO_BLOCKSIZE) FAIL; \ + cont_size = from_733(*rr->u.CE.size); \ + if (cont_size >= ISO_BLOCKSIZE) FAIL; \ + } -#define SETUP_ROCK_RIDGE(DE,CHR,LEN) \ +#define SETUP_ROCK_RIDGE(DE,CHR,LEN) \ { \ LEN= sizeof(iso9660_dir_t) + DE->filename.len; \ - if(LEN & 1) LEN++; \ + if (LEN & 1) LEN++; \ CHR = ((unsigned char *) DE) + LEN; \ LEN = *((unsigned char *) DE) - LEN; \ if (0xff != p_stat->rr.s_rock_offset) \ { \ - LEN -= p_stat->rr.s_rock_offset; \ - CHR += p_stat->rr.s_rock_offset; \ + LEN -= p_stat->rr.s_rock_offset; \ + CHR += p_stat->rr.s_rock_offset; \ if (LEN<0) LEN=0; \ } \ } @@ -130,22 +132,22 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow) the specified field of a iso_rock_statbuf_t. non-paramater variables are p_stat, rr, and cnt. */ -#define add_time(FLAG, TIME_FIELD) \ - if (rr->u.TF.flags & FLAG) { \ - p_stat->rr.TIME_FIELD.b_used = true; \ - p_stat->rr.TIME_FIELD.b_longdate = \ - (0 != (rr->u.TF.flags & ISO_ROCK_TF_LONG_FORM)); \ - if (p_stat->rr.TIME_FIELD.b_longdate) { \ - memcpy(&(p_stat->rr.TIME_FIELD.t.ltime), \ - &(rr->u.TF.time_bytes[cnt]), \ - sizeof(iso9660_ltime_t)); \ - cnt += sizeof(iso9660_ltime_t); \ - } else { \ - memcpy(&(p_stat->rr.TIME_FIELD.t.dtime), \ - &(rr->u.TF.time_bytes[cnt]), \ - sizeof(iso9660_dtime_t)); \ - cnt += sizeof(iso9660_dtime_t); \ - } \ +#define add_time(FLAG, TIME_FIELD) \ + if (rr->u.TF.flags & FLAG) { \ + p_stat->rr.TIME_FIELD.b_used = true; \ + p_stat->rr.TIME_FIELD.b_longdate = \ + (0 != (rr->u.TF.flags & ISO_ROCK_TF_LONG_FORM)); \ + if (p_stat->rr.TIME_FIELD.b_longdate) { \ + memcpy(&(p_stat->rr.TIME_FIELD.t.ltime), \ + &(rr->u.TF.time_bytes[cnt]), \ + sizeof(iso9660_ltime_t)); \ + cnt += sizeof(iso9660_ltime_t); \ + } else { \ + memcpy(&(p_stat->rr.TIME_FIELD.t.dtime), \ + &(rr->u.TF.time_bytes[cnt]), \ + sizeof(iso9660_dtime_t)); \ + cnt += sizeof(iso9660_dtime_t); \ + } \ } /* Indicates if we should process deep directory entries */ @@ -202,7 +204,7 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir, switch(sig) { case SIG('S','P'): - CHECK_SP(goto out); + CHECK_SP({cdio_warn("Invalid Rock Ridge SP field"); goto out;}); p_stat->rr.u_su_fields |= ISO_ROCK_SUF_SP; break; case SIG('C','E'): @@ -213,8 +215,17 @@ get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir, if ('\1' == p_iso9660_dir->filename.str[1] && 1 == i_fname) break; } - CHECK_CE; + CHECK_CE({cdio_warn("Invalid Rock Ridge CE field"); goto out;}); p_stat->rr.u_su_fields |= ISO_ROCK_SUF_CE; + /* We may already be processing a continuation block so free it */ + free(buffer); + buffer = calloc(1, ISO_BLOCKSIZE); + if (!buffer) + goto out; + if (iso9660_iso_seek_read(p_image, buffer, cont_extent, 1) != ISO_BLOCKSIZE) + goto out; + chr = &buffer[cont_offset]; + len = cont_size; break; case SIG('E','R'): cdio_debug("ISO 9660 Extensions: "); @@ -471,7 +482,7 @@ iso9660_get_rock_attr_str(posix_mode_t st_mode) result[ 8] = (st_mode & ISO_ROCK_IWOTH) ? 'w' : '-'; result[ 9] = (st_mode & ISO_ROCK_IXOTH) ? 'x' : '-'; - result[11] = '\0'; + result[10] = '\0'; return result; } diff --git a/src/rufus.rc b/src/rufus.rc index ebdc0640..0767a13e 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.22.1984" +CAPTION "Rufus 3.22.1985" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,22,1984,0 - PRODUCTVERSION 3,22,1984,0 + FILEVERSION 3,22,1985,0 + PRODUCTVERSION 3,22,1985,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.22.1984" + VALUE "FileVersion", "3.22.1985" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.22.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.22.1984" + VALUE "ProductVersion", "3.22.1985" END END BLOCK "VarFileInfo"