ref: 60e3d2782b30019769bd250c15329108fab1cc5a
parent: 225cc4af5c5be518460b204aaba7beb9e013d6a7
parent: 7ad47f1083f6d62d1135fe49807b51380cc4d7cb
author: cinap_lenrek <[email protected]>
date: Thu Oct 3 13:31:55 EDT 2013
merge
--- a/sys/src/cmd/tapefs/tarfs.c
+++ b/sys/src/cmd/tapefs/tarfs.c
@@ -144,10 +144,12 @@
}
f.mode &= DMDIR | 0777;
- /* make file name safe and canonical */
+ /* make file name safe, canonical and free of . and .. */
while (fname[0] == '/') /* don't allow absolute paths */
++fname;
cleanname(fname);
+ while (strncmp(fname, "../", 3) == 0)
+ fname += 3;
/* reject links */
linkflg = hp->linkflag == LF_SYMLINK1 ||