mirror of
https://github.com/MobSF/Mobile-Security-Framework-MobSF.git
synced 2026-10-12 02:06:59 +00:00
Resolve the situation where the function name is bytes (#2367)
fix error:
if function.name.endswith('_chk'):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: endswith first arg must be bytes or a tuple of bytes, not str
Co-authored-by: Ajin Abraham <[email protected]>
This commit is contained in:
co-authored by
Ajin Abraham
parent
ccfedc0e45
commit
6bce5a25b4
@@ -290,7 +290,14 @@ class ELFChecksec:
|
||||
def fortify(self):
|
||||
fortified_funcs = []
|
||||
for function in self.elf.symbols:
|
||||
if function.name.endswith('_chk'):
|
||||
if isinstance(function.name, bytes):
|
||||
try:
|
||||
function_name = function.name.decode('utf-8')
|
||||
except UnicodeDecodeError:
|
||||
function_name = function.name.decode('utf-8', 'replace')
|
||||
else:
|
||||
function_name = function.name
|
||||
if function_name.endswith('_chk'):
|
||||
fortified_funcs.append(function.name)
|
||||
return fortified_funcs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user