ref: 7ad47f1083f6d62d1135fe49807b51380cc4d7cb
parent: f163d0014a6ccd3417c45a05f831e73f2f9f6cf7
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Thu Oct 3 13:30:03 EDT 2013
tarfs: make file name safe, canonical and free of . and .. (from sources)
--- 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 ||
--
⑨