Bug fix: Option -mkdir yielded SIGSEGV due to a NULL pointer

This commit is contained in:
Thomas Schmitt 2011-01-31 14:05:58 +00:00
parent 25cda270ec
commit 5ead96341e
2 changed files with 37 additions and 20 deletions

View File

@ -611,20 +611,30 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter,
int target_is_split, hide_attrs;
struct stat stbuf;
ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&4));
if(ret<0)
return(ret);
if(ret>0)
return(3*!!(flag&16));
/* Check for mkisofs-style hidings */
hide_attrs= (flag >> 8) & 3;
if(hide_attrs != 3) {
ret= Xorriso_path_is_hidden(xorriso, disk_path, 0);
if (disk_path == NULL && !(flag & 1)) {
Xorriso_msgs_submit(xorriso, 0,
"Program error: Xorriso_graft_in(): disk_path == NULL && !(flag & 1)",
0, "ABORT", 0);
return(-1);
}
if (disk_path == NULL) {
disk_path= "";
} else {
ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&4));
if(ret<0)
return(ret);
if(ret>=0)
hide_attrs|= ret;
if(ret>0)
return(3*!!(flag&16));
/* Check for mkisofs-style hidings */
hide_attrs= (flag >> 8) & 3;
if(hide_attrs != 3) {
ret= Xorriso_path_is_hidden(xorriso, disk_path, 0);
if(ret<0)
return(ret);
if(ret>=0)
hide_attrs|= ret;
}
}
for(cpt= img_path; 1; cpt++) {
@ -638,10 +648,14 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter,
break;
}
if(cpt!=NULL) {
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
if(disk_path[0])
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"Unsupported relative addressing in iso_rr_path %s (disk: %s)",
Text_shellsafe(img_path, sfe, 0), Text_shellsafe(disk_path, sfe2, 0));
"Unsupported relative addressing in iso_rr_path %s",
Text_shellsafe(img_path, sfe, 0));
if(disk_path[0])
sprintf(xorriso->info_text + strlen(xorriso->info_text),
" (disk: %s)", Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
return(0);
}
@ -740,7 +754,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter,
return(ret);
if(ret==3) {
sprintf(xorriso->info_text, "User revoked adding of: %s",
Text_shellsafe(disk_path, sfe, 0));
disk_path[0] ? Text_shellsafe(disk_path, sfe, 0)
: Text_shellsafe(img_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
return(3*!!(flag&16));
}
@ -748,7 +763,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter,
goto handle_path_node;
}
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
if (disk_path[0])
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"While grafting '%s' : '%s' exists and may not be overwritten",
img_path, path);
@ -763,7 +779,8 @@ handle_path_node:;
ret= iso_tree_add_new_dir(dir, apt, &hdir);
if(ret<0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
if(disk_path[0])
Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0);
Xorriso_report_iso_error(xorriso, img_path, ret,
"Cannot create directory", 0, "FAILURE", 1);
sprintf(xorriso->info_text,
@ -777,7 +794,7 @@ handle_path_node:;
iso_node_set_uid((IsoNode *) dir, geteuid());
iso_node_set_gid((IsoNode *) dir, getegid());
if(disk_path!=NULL && !done)
if(disk_path[0] && !done)
/* This not only copies disk directory properties
but also sets eventual hide_attrs */
Xorriso_copy_implicit_properties(xorriso, dir, img_path, path, disk_path,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.01.26.210359"
#define Xorriso_timestamP "2011.01.31.135917"