When replacing path text in ELF binaries do not include null byte padding in search string (#15508)

This commit is contained in:
Patrick Gartung
2020-03-16 14:49:55 -05:00
committed by GitHub
parent a8706cc89b
commit 3029dde7ec

View File

@@ -447,7 +447,7 @@ def replace(match):
data = f.read()
f.seek(0)
original_data_len = len(data)
pat = re.compile(old_dir.encode('utf-8') + b'([^\0]*?)\0')
pat = re.compile(old_dir.encode('utf-8'))
if not pat.search(data):
return
ndata = pat.sub(replace, data)