Skip to content

Commit

Permalink
fix for python3 compatibility (#1467)
Browse files Browse the repository at this point in the history
if the value returned from the leak function is a str, it converts it to a bytearray for pytohn3 compatibility. Assuming a string is returned is flaky and likely wrong.
  • Loading branch information
Vigeant committed Apr 1, 2020
1 parent a7678f7 commit 91d464b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pwnlib/dynelf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ def gnu_hash(s):
Function used to generated GNU-style hashes for strings.
"""
if isinstance(s, str):
s = bytearray(s, 'utf8')
h = 5381
for c in s:
h = h * 33 + ord(c)
h = h * 33 + c
return h & 0xffffffff

class DynELF(object):
Expand Down

0 comments on commit 91d464b

Please sign in to comment.