SHA256
1
0
forked from pool/libcdio
libcdio/libcdio-joliet-name-overflow.patch

105 lines
3.5 KiB
Diff

--- src/cd-info.c 2007/06/16 20:12:16 1.149
+++ src/cd-info.c 2008/01/09 04:26:24 1.152 (reduced patch)
@@ -518,6 +518,8 @@
CdioList_t *p_dirlist = _cdio_list_new ();
CdioListNode_t *entnode;
uint8_t i_joliet_level;
+ char *translated_name = (char *) malloc(4096);
+ size_t translated_name_size = 4096;
i_joliet_level = (opts.no_joliet)
? 0
@@ -539,7 +541,15 @@
iso9660_stat_t *p_statbuf = _cdio_list_node_data (entnode);
char *psz_iso_name = p_statbuf->filename;
char _fullname[4096] = { 0, };
- char translated_name[MAX_ISONAME+1];
+ if (strlen(psz_iso_name) >= translated_name_size) {
+ translated_name_size = strlen(psz_iso_name)+1;
+ free(translated_name);
+ translated_name = (char *) malloc(translated_name_size);
+ if (!translated_name) {
+ report( stderr, "Error allocating memory\n" );
+ return;
+ }
+ }
if (yep != p_statbuf->rr.b3_rock || 1 == opts.no_rock_ridge) {
iso9660_name_translate_ext(psz_iso_name, translated_name,
@@ -564,6 +574,7 @@
p_statbuf->rr.i_symlink = 0;
}
}
+ free (translated_name);
_cdio_list_free (p_entlist, true);
--- src/iso-info.c 2006/03/17 19:36:54 1.35
+++ src/iso-info.c 2008/01/09 04:26:24 1.38 (reduced patch)
@@ -205,7 +205,8 @@
CdioList_t *dirlist = _cdio_list_new ();
CdioListNode_t *entnode;
uint8_t i_joliet_level = iso9660_ifs_get_joliet_level(p_iso);
-
+ char *translated_name = (char *) malloc(4096);
+ size_t translated_name_size = 4096;
entlist = iso9660_ifs_readdir (p_iso, psz_path);
if (opts.print_iso9660) {
@@ -224,7 +225,15 @@
iso9660_stat_t *p_statbuf = _cdio_list_node_data (entnode);
char *psz_iso_name = p_statbuf->filename;
char _fullname[4096] = { 0, };
- char translated_name[MAX_ISONAME+1];
+ if (strlen(psz_iso_name) >= translated_name_size) {
+ translated_name_size = strlen(psz_iso_name)+1;
+ free(translated_name);
+ translated_name = (char *) malloc(translated_name_size);
+ if (!translated_name) {
+ report( stderr, "Error allocating memory\n" );
+ return;
+ }
+ }
if (yep != p_statbuf->rr.b3_rock || 1 == opts.no_rock_ridge) {
iso9660_name_translate_ext(psz_iso_name, translated_name,
@@ -258,6 +267,7 @@
p_statbuf->rr.i_symlink = 0;
}
}
+ free (translated_name);
_cdio_list_free (entlist, true);
--- src/mmc-tool.c 2006/04/14 22:17:08 1.9
+++ src/mmc-tool.c 2008/01/09 04:26:24 1.10 (reduced patch)
@@ -261,7 +261,7 @@
}
static void
-print_mode_sense (unsigned int i_mmc_size, const uint8_t buf[22])
+print_mode_sense (unsigned int i_mmc_size, const uint8_t buf[30])
{
printf("Mode sense %d information\n", i_mmc_size);
if (buf[2] & 0x01) {
@@ -461,7 +461,7 @@
break;
case OP_MODE_SENSE_2A:
{
- uint8_t buf[22] = { 0, }; /* Place to hold returned data */
+ uint8_t buf[30] = { 0, }; /* Place to hold returned data */
if (p_op->arg.i_num == 10) {
rc = mmc_mode_sense_10(p_cdio, buf, sizeof(buf),
CDIO_MMC_CAPABILITIES_PAGE);
--- example/udf1.c 2005/11/02 03:42:49 1.17
+++ example/udf1.c 2008/01/09 04:27:16 1.18 (reduced patch)
@@ -127,7 +127,7 @@
printf("volume id: %s\n", vol_id);
if (0 < udf_get_volume_id(p_udf, volset_id, sizeof(volset_id)) ) {
- volset_id[UDF_VOLSET_ID_SIZE+1]='\0';
+ volset_id[UDF_VOLSET_ID_SIZE]='\0';
printf("volume set id: %s\n", volset_id);
}