mirror of
https://github.com/9001/copyparty.git
synced 2025-10-03 17:59:19 +02:00
suboptimizations and some future safeguards
This commit is contained in:
parent
f1358dbaba
commit
86419b8f47
14 changed files with 79 additions and 81 deletions
|
@ -262,7 +262,7 @@ def unpack():
|
|||
final = opj(top, name)
|
||||
san = opj(final, "copyparty/up2k.py")
|
||||
for suf in range(0, 9001):
|
||||
withpid = "{}.{}.{}".format(name, os.getpid(), suf)
|
||||
withpid = "%s.%d.%s" % (name, os.getpid(), suf)
|
||||
mine = opj(top, withpid)
|
||||
if not ofe(mine):
|
||||
break
|
||||
|
@ -285,8 +285,8 @@ def unpack():
|
|||
|
||||
ck = hashfile(tar)
|
||||
if ck != CKSUM:
|
||||
t = "\n\nexpected {} ({} byte)\nobtained {} ({} byte)\nsfx corrupt"
|
||||
raise Exception(t.format(CKSUM, SIZE, ck, sz))
|
||||
t = "\n\nexpected %s (%d byte)\nobtained %s (%d byte)\nsfx corrupt"
|
||||
raise Exception(t % (CKSUM, SIZE, ck, sz))
|
||||
|
||||
with tarfile.open(tar, "r:bz2") as tf:
|
||||
# this is safe against traversal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue