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

View File

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