forked from mirrors/pyinstxtractor
Backport non UTF-8 file name bugfix from pyinstxtractor-ng
This commit is contained in:
parent
4c89bd51db
commit
9565295780
1 changed files with 6 additions and 1 deletions
|
|
@ -231,7 +231,12 @@ class PyInstArchive:
|
||||||
'!IIIBc{0}s'.format(entrySize - nameLen), \
|
'!IIIBc{0}s'.format(entrySize - nameLen), \
|
||||||
self.fPtr.read(entrySize - 4))
|
self.fPtr.read(entrySize - 4))
|
||||||
|
|
||||||
name = name.decode('utf-8').rstrip('\0')
|
try:
|
||||||
|
name = name.decode("utf-8").rstrip("\0")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
newName = str(uniquename())
|
||||||
|
print('[!] Warning: File name {0} contains invalid bytes. Using random name {1}'.format(name, newName))
|
||||||
|
name = newName
|
||||||
|
|
||||||
# Prevent writing outside the extraction directory
|
# Prevent writing outside the extraction directory
|
||||||
if name.startswith("/"):
|
if name.startswith("/"):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue