mirror of https://github.com/pbatard/rufus.git
[iso] fix underflow buffers, deny optimize global var and replace strlen
This commit is contained in:
parent
0de209ee53
commit
3407d3d5f4
|
@ -502,7 +502,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
|
|||
while ((p_udf_dirent = udf_readdir(p_udf_dirent)) != NULL) {
|
||||
if (FormatStatus) goto out;
|
||||
psz_basename = udf_get_filename(p_udf_dirent);
|
||||
if (strlen(psz_basename) == 0)
|
||||
if (psz_basename[0] != '\0')
|
||||
continue;
|
||||
length = (int)(3 + strlen(psz_path) + strlen(psz_basename) + strlen(psz_extract_dir) + 24);
|
||||
psz_fullpath = (char*)calloc(sizeof(char), length);
|
||||
|
|
|
@ -334,6 +334,7 @@ struct anchor_vol_desc_ptr_s
|
|||
} GNUC_PACKED;
|
||||
|
||||
typedef struct anchor_vol_desc_ptr_s anchor_vol_desc_ptr_t;
|
||||
typedef struct anchor_vol_desc_ptr_s *ptr_anchor_vol_desc_ptr_t;
|
||||
|
||||
/** Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
|
||||
struct vol_desc_ptr_s
|
||||
|
|
|
@ -391,6 +391,7 @@ struct iso9660_pvd_s {
|
|||
} GNUC_PACKED;
|
||||
|
||||
typedef struct iso9660_pvd_s iso9660_pvd_t;
|
||||
typedef struct iso9660_pvd_s *ptr_iso9660_pvd_t;
|
||||
|
||||
/*!
|
||||
\brief ISO-9660 Supplementary Volume Descriptor.
|
||||
|
@ -505,6 +506,7 @@ struct iso9660_svd_s {
|
|||
} GNUC_PACKED;
|
||||
|
||||
typedef struct iso9660_svd_s iso9660_svd_t;
|
||||
typedef struct iso9660_svd_s *ptr_iso9660_svd_t;
|
||||
|
||||
PRAGMA_END_PACKED
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ get_member_id(iso9660_t *p_iso, cdio_utf8_t **p_psz_member_id,
|
|||
strip = false;
|
||||
(*p_psz_member_id)[j] = pvd_member[j];
|
||||
}
|
||||
if (strlen(*p_psz_member_id) == 0) {
|
||||
if (*p_psz_member_id[0] != '\0') {
|
||||
free(*p_psz_member_id);
|
||||
*p_psz_member_id = NULL;
|
||||
return false;
|
||||
|
@ -638,7 +638,7 @@ iso9660_fs_read_pvd(const CdIo_t *p_cdio, /*out*/ iso9660_pvd_t *p_pvd)
|
|||
the part we need to save.
|
||||
*/
|
||||
cdio_assert (sizeof(buf) >= sizeof (iso9660_pvd_t));
|
||||
memcpy(p_pvd, buf, sizeof(iso9660_pvd_t));
|
||||
memcpy(p_pvd, buf, sizeof(ptr_iso9660_pvd_t));
|
||||
|
||||
return check_pvd(p_pvd, CDIO_LOG_WARN);
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ iso9660_fs_read_superblock (CdIo_t *p_cdio,
|
|||
the part we need to save.
|
||||
*/
|
||||
cdio_assert (sizeof(buf) >= sizeof (iso9660_svd_t));
|
||||
memcpy(p_svd, buf, sizeof(iso9660_svd_t));
|
||||
memcpy(p_svd, buf, sizeof(ptr_iso9660_svd_t));
|
||||
|
||||
if ( ISO_VD_SUPPLEMENTARY == from_711(p_svd->type) ) {
|
||||
if (p_svd->escape_sequences[0] == 0x25
|
||||
|
@ -1936,7 +1936,7 @@ iso_have_rr_traverse (iso9660_t *p_iso, const iso9660_stat_t *_root,
|
|||
p_iso->b_xa, p_iso->u_joliet_level);
|
||||
have_rr = p_stat->rr.b3_rock;
|
||||
if ( have_rr != yep) {
|
||||
if (strlen(splitpath[0]) == 0)
|
||||
if (splitpath[0][0] != '\0')
|
||||
have_rr = false;
|
||||
else
|
||||
have_rr = iso_have_rr_traverse (p_iso, p_stat, &splitpath[i_last_component],
|
||||
|
|
|
@ -394,7 +394,7 @@ udf_open (const char *psz_path)
|
|||
if (DRIVER_OP_SUCCESS != udf_read_sectors (p_udf, &data, 256, 1) )
|
||||
goto error;
|
||||
|
||||
memcpy(&(p_udf->anchor_vol_desc_ptr), &data, sizeof(anchor_vol_desc_ptr_t));
|
||||
memcpy(&(p_udf->anchor_vol_desc_ptr), &data, sizeof(ptr_anchor_vol_desc_ptr_t));
|
||||
|
||||
if (udf_checktag((udf_tag_t *)&(p_udf->anchor_vol_desc_ptr), TAGID_ANCHOR))
|
||||
goto error;
|
||||
|
|
|
@ -54,7 +54,7 @@ extern loc_cmd* selected_locale;
|
|||
extern HANDLE dialog_handle;
|
||||
extern BOOL is_x86_32;
|
||||
static DWORD error_code, fido_len = 0;
|
||||
static BOOL force_update_check = FALSE;
|
||||
volatile static BOOL force_update_check = FALSE;
|
||||
static const char* request_headers = "Accept-Encoding: gzip, deflate";
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
|
|
Loading…
Reference in New Issue