Bug fix: Disk paths with components . or .. could be mistaken for directories

This commit is contained in:
Thomas Schmitt 2013-04-13 14:50:37 +00:00
parent 83d7877f70
commit 20d9fb55e9
2 changed files with 8 additions and 4 deletions

View File

@ -98,6 +98,9 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd,
{ret= 2; goto ex;} /* root directory */ {ret= 2; goto ex;} /* root directory */
} }
if(apt[0] == '.')
if(apt[1] == 0 || apt[1] == '/')
is_dir= 1;
for(npt= apt; !done; apt= npt+1) { for(npt= apt; !done; apt= npt+1) {
npt= strchr(apt, '/'); npt= strchr(apt, '/');
if(npt==NULL) { if(npt==NULL) {
@ -112,10 +115,8 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd,
break; break;
continue; continue;
} }
if(strcmp(apt,".")==0) { if(strcmp(apt,".")==0)
is_dir= 1;
continue; continue;
}
if(strcmp(apt,"..")==0) { if(strcmp(apt,"..")==0) {
if(!(flag&2)) { if(!(flag&2)) {
node= (IsoNode *) dir; node= (IsoNode *) dir;
@ -137,6 +138,7 @@ bonked_root:;
is_dir= 1; is_dir= 1;
continue; continue;
} }
is_dir= 0;
ret= Sfile_add_to_path(eff_path, apt, 0); ret= Sfile_add_to_path(eff_path, apt, 0);
if(ret<=0) { if(ret<=0) {
much_too_long:; much_too_long:;
@ -163,6 +165,8 @@ much_too_long:;
{ret= 0; goto ex;} {ret= 0; goto ex;}
if(ret==2) if(ret==2)
is_dir= 1; is_dir= 1;
else
is_dir= 0;
} }
ret= 1+!!is_dir; ret= 1+!!is_dir;
ex:; ex:;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.04.13.074309" #define Xorriso_timestamP "2013.04.13.144946"