You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SOCKS5 domain response parsing starts at the length byte #675
When parsing a SOCKS5 response whose address type is a domain name, checkServerReply() reads the domain length from byte 4 but copies the address starting at byte 4 as well. Byte 4 is the length byte, so the parsed host is shifted by one byte and the port offsets are wrong.
This models the offsets used by the current parser; the length byte is incorrectly treated as the first host byte.
Expected behavior
The host bytes should be copied from offset 5, and the two port bytes should follow the domain at offsets 5 + length and 6 + length.
Actual behavior
The length byte is included in the copied host, and the port is read one byte too early. A domain-name bind response can therefore produce a corrupted log/diagnostic and incorrect port information.
Existing coverage
The checked issue and PR history did not contain an exact report or fix for this domain-response offset.
Suggested fix
Use the protocol offsets explicitly: skip byte 4 when copying the domain and read the port after the domain bytes.
Suggested tests
A domain response such as example.com:443.
One-character and maximum-length domains.
IPv4 and IPv6 response branches remain unchanged.
Assert the parsed host and port from exact response bytes.
Fixed on develop in aea9b88. SOCKS5 domain replies now decode the hostname after its length octet and read the port after the complete hostname, restoring accurate reply diagnostics. Scheduled for 9.1.5.
Activity
fix(socks): parse domain replies after length byte (#675)
bbottema commentedon Aug 5, 2026
Fixed on develop in aea9b88. SOCKS5 domain replies now decode the hostname after its length octet and read the port after the complete hostname, restoring accurate reply diagnostics. Scheduled for 9.1.5.
bbottema commentedon Aug 5, 2026
The fix is now available in Simple Java Mail 9.1.5 and from Maven Central.