From 20d9fb55e954d67b94ffb276afcf74cd37512d7e Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 13 Apr 2013 14:50:37 +0000 Subject: [PATCH] Bug fix: Disk paths with components . or .. could be mistaken for directories --- xorriso/iso_tree.c | 10 +++++++--- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xorriso/iso_tree.c b/xorriso/iso_tree.c index 97082677..1343b1a5 100644 --- a/xorriso/iso_tree.c +++ b/xorriso/iso_tree.c @@ -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:; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index ab4b9da5..f2a2b8f2 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2013.04.13.074309" +#define Xorriso_timestamP "2013.04.13.144946"