tarfs: make file name safe, canonical and free of . and .. (from sources)

This commit is contained in:
cinap_lenrek 2013-10-03 17:30:03 +02:00
parent f163d0014a
commit 7ad47f1083

View file

@ -144,10 +144,12 @@ populate(char *name)
}
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 ||