Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions socksio/socks4.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ def loads(cls, data: bytes) -> "SOCKS4Reply":
Raises:
ProtocolError: If the data does not match the spec.
"""
if isinstance(data, bytearray):
data = bytes(data)

if len(data) != 8 or data[0:1] != b"\x00":
raise ProtocolError("Malformed reply")

Expand Down
3 changes: 3 additions & 0 deletions socksio/socks5.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ def loads(cls, data: bytes) -> "SOCKS5Reply":
Raises:
ProtocolError: If the data does not match the spec.
"""
if isinstance(data, bytearray):
data = bytes(data)

if data[0:1] != b"\x05":
raise ProtocolError("Malformed reply")

Expand Down