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