Fossil SCM

Fix the "add" command is that it does not allow users to accidently add files that contain shell wildcard characters.

drh 2007-10-15 20:45 UTC trunk
Commit da9d38e2c38f5271e1abbdee4a771a09be3a1812
1 file changed +3
+3
--- src/add.c
+++ src/add.c
@@ -64,10 +64,13 @@
6464
file_tree_name(zName, &pathname);
6565
zPath = blob_str(&pathname);
6666
if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
6767
fossil_fatal("cannot add %s", zPath);
6868
}
69
+ if( !file_is_simple_pathname(zPath) ){
70
+ fossil_fatal("filename contains illegal characters: %s", zPath);
71
+ }
6972
if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
7073
db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
7174
}else{
7275
db_multi_exec(
7376
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
7477
--- src/add.c
+++ src/add.c
@@ -64,10 +64,13 @@
64 file_tree_name(zName, &pathname);
65 zPath = blob_str(&pathname);
66 if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
67 fossil_fatal("cannot add %s", zPath);
68 }
 
 
 
69 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
70 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
71 }else{
72 db_multi_exec(
73 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
74
--- src/add.c
+++ src/add.c
@@ -64,10 +64,13 @@
64 file_tree_name(zName, &pathname);
65 zPath = blob_str(&pathname);
66 if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
67 fossil_fatal("cannot add %s", zPath);
68 }
69 if( !file_is_simple_pathname(zPath) ){
70 fossil_fatal("filename contains illegal characters: %s", zPath);
71 }
72 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
73 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
74 }else{
75 db_multi_exec(
76 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
77

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button