Enlarged string size limit of Text_shellsafe()

This commit is contained in:
Thomas Schmitt 2007-11-08 16:11:26 +00:00
parent 9dc3dbb1ab
commit 8dbcfae46b
3 changed files with 32 additions and 32 deletions

View File

@ -1754,7 +1754,7 @@ char *Text_shellsafe(char *in_text, char *out_text, int flag)
out_text[w++]= '\'';
for(i=0;i<l;i++){
if(in_text[i]=='\''){
if(w+7>4*SfileadrL)
if(w+7>5*SfileadrL)
goto overflow;
/* escape hard quote within the text */
out_text[w++]= '\'';
@ -1763,7 +1763,7 @@ char *Text_shellsafe(char *in_text, char *out_text, int flag)
out_text[w++]= '"';
out_text[w++]= '\'';
} else {
if(w+3>4*SfileadrL) {
if(w+3>5*SfileadrL) {
overflow:;
strncpy(out_text, "'xorriso: TEXT MUCH TOO LONG ... ",33);
break;
@ -3174,7 +3174,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
*/
{
int is_default,no_defaults,i;
char *line, sfe[4*SfileadrL];
char *line, sfe[5*SfileadrL];
static char channel_prefixes[4][4]= {".","R","I","M"};
no_defaults= flag&1;
@ -3638,7 +3638,7 @@ int Xorriso_convert_gidstring(struct XorrisO *xorriso, char *gid_string,
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag)
{
int ret, sev;
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
ret= Xorriso__text_to_sev(severity, &sev, 0);
if(ret<=0) {
@ -3768,7 +3768,7 @@ int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag)
/* @param flag bit0= format rather than blank */
int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag)
{
char drive_name[SfileadrL], *cmd= "-blank", sfe[4*SfileadrL];
char drive_name[SfileadrL], *cmd= "-blank", sfe[5*SfileadrL];
int ret, aq_flag= 2, mode_flag;
if(flag&1)
@ -3838,7 +3838,7 @@ int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag)
/* Option -cd alias -cdi */
int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
{
char sfe[4*SfileadrL], path[SfileadrL], eff_path[SfileadrL];
char sfe[5*SfileadrL], path[SfileadrL], eff_path[SfileadrL];
int ret;
if (strlen(iso_rr_path)>sizeof(xorriso->wdi)) {
@ -3891,7 +3891,7 @@ int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
/* Option -cdx */
int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
{
char sfe[4*SfileadrL], path[SfileadrL], eff_path[SfileadrL];;
char sfe[5*SfileadrL], path[SfileadrL], eff_path[SfileadrL];;
int ret;
if (strlen(disk_path)>sizeof(xorriso->wdx)) {
@ -3980,7 +3980,7 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
int i, end_idx, ret, who_val= 0, was_failure= 0;
unsigned int num;
mode_t mode_and= ~0, mode_or= 0, mode_val, mask;
char sfe[4*SfileadrL], *mpt, *opt, *vpt;
char sfe[5*SfileadrL], *mpt, *opt, *vpt;
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 0);
@ -4191,7 +4191,7 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
{
int ret;
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
if(xorriso->ban_stdio_write && strncmp(adr, "stdio:", 6)==0) {
sprintf(xorriso->info_text,
@ -4247,7 +4247,7 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
int Xorriso_option_devices(struct XorrisO *xorriso, int flag)
{
int ret;
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
if(xorriso->volset_change_pending) {
sprintf(xorriso->info_text,
@ -4346,7 +4346,7 @@ int Xorriso_option_f(struct XorrisO *xorriso, int flag)
/* Option -find alias -findi */
int Xorriso_option_findi(struct XorrisO *xorriso, char *pattern, int flag)
{
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
fprintf(stderr, ">>> XORRISO : filter by pattern %s\n", pattern);
/* >>> prepare regex */
@ -4361,7 +4361,7 @@ int Xorriso_option_findi(struct XorrisO *xorriso, char *pattern, int flag)
/* Option -findx */
int Xorriso_option_findx(struct XorrisO *xorriso, char *pattern, int flag)
{
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
fprintf(stderr, ">>> XORRISO : filter by pattern %s\n", pattern);
/* >>> prepare regex */
@ -4758,7 +4758,7 @@ ex:;
/* @param flag bit0= long format (-ls_l) */
int Xorriso_option_lsx(struct XorrisO *xorriso, char *pattern, int flag)
{
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
fprintf(stderr, ">>> XORRISO : filter by pattern %s\n", pattern);
/* >>> prepare regex */
@ -4846,7 +4846,7 @@ int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, end_idx, ret, is_dir= 0, was_failure= 0;
char sfe[4*SfileadrL], sfe2[4*SfileadrL];
char sfe[5*SfileadrL], sfe2[5*SfileadrL];
char eff_origin[SfileadrL], eff_dest[SfileadrL];
char dest_dir[SfileadrL], *leafname;
@ -4942,7 +4942,7 @@ return:
{
int ret,linecount= 0, argc;
FILE *fp= NULL;
char line[4*SfileadrL], shellsafe[5*SfileadrL];
char line[5*SfileadrL], shellsafe[5*SfileadrL];
char **argv= NULL;
if(adr[0]==0) {
@ -5043,7 +5043,7 @@ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
{
int ret,linecount= 0, insertcount= 0, null= 0;
FILE *fp= NULL;
char *argpt, sfe[4*SfileadrL],line[SfileadrL];
char *argpt, sfe[5*SfileadrL],line[SfileadrL];
if(adr[0]==0) {
sprintf(xorriso->info_text,"Empty file name given with -path-list");
@ -5219,7 +5219,7 @@ int Xorriso_option_report_about(struct XorrisO *xorriso, char *severity,
int flag)
{
int ret, sev;
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
ret= Xorriso__text_to_sev(severity, &sev, 0);
if(ret<=0) {

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.11.08.160302"
#define Xorriso_timestamP "2007.11.08.161215"

View File

@ -482,7 +482,7 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
struct iso_volume *volume;
struct iso_tree_node_dir *dir= NULL;
struct iso_tree_node *node= NULL;
char path[SfileadrL], *apt, *npt, sfe[4*SfileadrL], *cpt;
char path[SfileadrL], *apt, *npt, sfe[5*SfileadrL], *cpt;
eff_path[0]= 0;
if(img_path[0]==0)
@ -585,7 +585,7 @@ int Xorriso_get_node_by_path(struct XorrisO *xorriso,
struct iso_tree_node **node, int flag)
{
int ret;
char sfe[4*SfileadrL], path[SfileadrL];
char sfe[5*SfileadrL], path[SfileadrL];
struct iso_volume *volume;
ret= Xorriso_normalize_img_path(xorriso, in_path, path, 0);
@ -615,7 +615,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
struct iso_tree_node *node;
int ret, target_is_dir, source_is_dir;
struct DirseQ *dirseq= NULL;
char sfe[4*SfileadrL], sfe2[4*SfileadrL];
char sfe[5*SfileadrL], sfe2[5*SfileadrL];
char disk_path[2*SfileadrL], img_path[2*SfileadrL];
char *name, *img_name;
struct stat stbuf;
@ -752,7 +752,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
int flag)
{
struct iso_volume *volume;
char path[SfileadrL], *apt, *npt, *cpt, sfe[4*SfileadrL];
char path[SfileadrL], *apt, *npt, *cpt, sfe[5*SfileadrL];
struct iso_tree_node_dir *dir;
struct iso_tree_node *node;
int done= 0, is_dir= 0, l, ret, target_is_dir, source_is_dir;
@ -1396,7 +1396,7 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
int Xorriso_node_from_path(struct XorrisO *xorriso, struct iso_volume *volume,
char *path, struct iso_tree_node **node, int flag)
{
char sfe[4*SfileadrL];
char sfe[5*SfileadrL];
*node= iso_tree_volume_path_to_node(volume, path);
Xorriso_process_msg_queues(xorriso,0);
@ -1430,7 +1430,7 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
struct iso_tree_node_dir *boss_node, *root_dir;
struct iso_tree_iter *iter= NULL;
struct iso_volume *volume;
char sfe[4*SfileadrL], sub_path[2*SfileadrL], *sub_name, *name;
char sfe[5*SfileadrL], sub_path[2*SfileadrL], *sub_name, *name;
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
@ -1669,7 +1669,7 @@ int Xorriso_show_du_subs(struct XorrisO *xorriso,
int i, ret, no_sort= 0, filec= 0, l;
struct iso_tree_iter *iter= NULL;
struct iso_tree_node *node, **node_array= NULL;
char path[SfileadrL], show_path[SfileadrL], *name, sfe[4*SfileadrL];
char path[SfileadrL], show_path[SfileadrL], *name, sfe[5*SfileadrL];
off_t sub_size, report_size, mem= 0;
*size= 0;
@ -1812,7 +1812,7 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, int filec, char **filev,
int i, ret, was_error= 0;
struct iso_tree_node *node;
struct iso_volume *volume;
char sfe[4*SfileadrL], path[SfileadrL], *rpt, perms[10];
char sfe[5*SfileadrL], path[SfileadrL], *rpt, perms[10];
mode_t st_mode;
off_t size;
time_t mtime;
@ -1942,7 +1942,7 @@ int Xorriso_ls(struct XorrisO *xorriso, int flag)
struct iso_tree_node_dir *dir_node;
struct iso_volume *volume;
struct iso_tree_iter *iter= NULL;
char sfe[4*SfileadrL], *npt, *rpt, perms[10];
char sfe[5*SfileadrL], *npt, *rpt, perms[10];
mode_t st_mode;
off_t size;
time_t mtime;
@ -2073,8 +2073,8 @@ ex:;
int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
{
int ret, ol, dest_ret;
char sfe[4*SfileadrL], eff_dest[SfileadrL], dir_adr[SfileadrL], *cpt;
char *leafname, eff_origin[SfileadrL], sfe2[4*SfileadrL];
char sfe[5*SfileadrL], eff_dest[SfileadrL], dir_adr[SfileadrL], *cpt;
char *leafname, eff_origin[SfileadrL], sfe2[5*SfileadrL];
struct iso_volume *volume;
struct iso_tree_node_dir *origin_dir, *dest_dir;
struct iso_tree_node *node;
@ -2196,7 +2196,7 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
int Xorriso_mkdir(struct XorrisO *xorriso, char *path, int flag)
{
int ret;
char eff_path[SfileadrL], sfe[4*SfileadrL];
char eff_path[SfileadrL], sfe[5*SfileadrL];
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 1);
if(ret<0)
@ -2326,7 +2326,7 @@ int Xorriso_expand_pattern(struct XorrisO *xorriso,
int *filec, char ***filev, off_t *mem, int flag)
{
int ret, count= 0, abs_adr= 0, i, l, was_count, was_filec;
char mem_text[80], limit_text[80], sfe[4*SfileadrL];
char mem_text[80], limit_text[80], sfe[5*SfileadrL];
struct iso_volume *volume;
struct iso_tree_node_dir *dir, *root_dir;
@ -2472,7 +2472,7 @@ int Xorriso_set_st_mode(struct XorrisO *xorriso, char *in_path,
mode_t mode= 0;
int ret;
struct iso_tree_node *node;
char sfe[4*SfileadrL], path[SfileadrL];
char sfe[5*SfileadrL], path[SfileadrL];
ret= Xorriso_get_node_by_path(xorriso, in_path, path, &node, 0);
if(ret<=0)