Skip to content

Commit

Permalink
fix: tls_read(): use .raw instead of .value (#2)
Browse files Browse the repository at this point in the history
`.value` treats the underlying buffer as a NUL-terminated string, which
will truncate binary data that contains '\0', whereas `.raw` returns the
entire blob as-is - patch by FoleyDiver
  • Loading branch information
FoleyDiver authored Feb 2, 2023
1 parent 9f42d99 commit dfcfdfa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tls/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def tls_read(_ctx, _buflen=2048):
r = lib.tls_read(_ctx, _buf, _buflen)
if r == -1:
raise TLSError(tls_error(_ctx))
return _buf.value
return _buf.raw[:r]


def tls_write(_ctx, _data):
Expand Down

0 comments on commit dfcfdfa

Please sign in to comment.