diff --git a/xorriso/emulators.c b/xorriso/emulators.c index f2c33c52..6fbdb29b 100644 --- a/xorriso/emulators.c +++ b/xorriso/emulators.c @@ -1686,9 +1686,16 @@ is_pathspec_2:; pathspec[0]= '/'; pathspec[1]= 0; ret= Sfile_leafname(eff_path, pathspec+1, 0); - if(ret>0) + if(ret>0) { + ret= Fileliste__escape_source_path(pathspec, SfileadrL, 0); + if(ret <= 0) { + Xorriso_msgs_submit(xorriso, 0, + "Escaped leaf name gets much too long", + 0, "FAILURE", 0); + goto problem_handler_2; + } strcat(pathspec, "="); - else + } else pathspec[0]= 0; } strcat(pathspec, eff_path); diff --git a/xorriso/misc_funct.c b/xorriso/misc_funct.c index 3abb888b..e3fc69b2 100644 --- a/xorriso/misc_funct.c +++ b/xorriso/misc_funct.c @@ -1,7 +1,7 @@ /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. - Copyright 2007-2010 Thomas Schmitt, + Copyright 2007-2012 Thomas Schmitt, Provided under GPL version 2 or later. @@ -1110,6 +1110,28 @@ int Fileliste__target_source_limit(char *line, char sep, char **limit_pt, } +int Fileliste__escape_source_path(char *line, int size, int flag) +{ + int l, count= 0, i; + char *wpt; + + l= strlen(line); + for(i= 0; i < l; i++) + if(line[i] == '=' || line[i] == '\\') + count++; + if(l + count >= size) + return(0); + + wpt= line + l + count; + for(i= l; i >= 0; i--) { + *(wpt--)= line[i]; + if(line[i] == '=' || line[i] == '\\') + *(wpt--)= '\\'; + } + return(1); +} + + int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag) /* reg_expr should be twice as large as bourne_expr ( + 2 to be exact) */ /* return: 2= bourne_expr is surely a constant */ diff --git a/xorriso/misc_funct.h b/xorriso/misc_funct.h index 317f1458..7e860c1a 100644 --- a/xorriso/misc_funct.h +++ b/xorriso/misc_funct.h @@ -1,7 +1,7 @@ /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. - Copyright 2007-2010 Thomas Schmitt, + Copyright 2007-2012 Thomas Schmitt, Provided under GPL version 2 or later. @@ -54,6 +54,8 @@ int Wait_for_input(int fd, int microsec, int flag); int Fileliste__target_source_limit(char *line, char sep, char **limit_pt, int flag); +int Fileliste__escape_source_path(char *line, int size, int flag); + int Hex_to_bin(char *hex, int bin_size, int *bin_count, unsigned char *bin_data, int flag); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 339f7a5f..edfdc5ea 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2012.03.21.193557" +#define Xorriso_timestamP "2012.03.22.084956"