Sophie

Sophie

distrib > Mandriva > 2008.0 > i586 > by-pkgid > b53c7f84bd5191eec9e361fb59837ec2 > files > 2

libcdio-0.78.2-1.3mdv2008.0.src.rpm

Index: libcdio-0.78.2/src/cd-info.c
===================================================================
--- libcdio-0.78.2.orig/src/cd-info.c
+++ libcdio-0.78.2/src/cd-info.c
@@ -518,6 +518,8 @@ print_iso9660_recurse (CdIo_t *p_cdio, c
   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 @@ print_iso9660_recurse (CdIo_t *p_cdio, c
       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 @@ print_iso9660_recurse (CdIo_t *p_cdio, c
 	p_statbuf->rr.i_symlink = 0;
       }
     }
+    free (translated_name);
 
   _cdio_list_free (p_entlist, true);
 
Index: libcdio-0.78.2/src/iso-info.c
===================================================================
--- libcdio-0.78.2.orig/src/iso-info.c
+++ libcdio-0.78.2/src/iso-info.c
@@ -205,7 +205,8 @@ print_iso9660_recurse (iso9660_t *p_iso,
   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,16 @@ print_iso9660_recurse (iso9660_t *p_iso,
       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 +268,7 @@ print_iso9660_recurse (iso9660_t *p_iso,
 	p_statbuf->rr.i_symlink = 0;
       }
     }
+    free (translated_name);
 
   _cdio_list_free (entlist, true);