Skip to content

Commit

Permalink
Do a typecheck in case someone tries to send garbage bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed May 16, 2019
1 parent 035c83d commit ccb9810
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hunter/remote.py
Expand Up @@ -46,6 +46,8 @@ def isatty(self):

def write(self, data):
try:
if isinstance(data, bytes):
data = data.decode('ascii', 'replace')
self._sock.send(data.encode(self._encoding))
except Exception as exc:
print("Hunter failed to send trace output %r (encoding: %r): %s. Stopping tracer." % (
Expand Down

0 comments on commit ccb9810

Please sign in to comment.