Skip to content

Commit dfcfdfa

Browse files
authored
fix: tls_read(): use .raw instead of .value (#2)
`.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
1 parent 9f42d99 commit dfcfdfa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tls/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def tls_read(_ctx, _buflen=2048):
218218
r = lib.tls_read(_ctx, _buf, _buflen)
219219
if r == -1:
220220
raise TLSError(tls_error(_ctx))
221-
return _buf.value
221+
return _buf.raw[:r]
222222

223223

224224
def tls_write(_ctx, _data):

0 commit comments

Comments
 (0)