From d0d0b2ec84e88fce2112b7fa1d3cab542e3217ca Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Wed, 22 May 2019 00:37:00 +0300 Subject: [PATCH] Insert exactly 16 bytes of encoded remote host name into version message --- src/protocol.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/protocol.py b/src/protocol.py index 9a0c6a11..fd3da38f 100644 --- a/src/protocol.py +++ b/src/protocol.py @@ -262,7 +262,9 @@ def assembleVersionMessage(remoteHost, remotePort, participatingStreams, server= payload += encodeHost('127.0.0.1') payload += pack('>H', 8444) else: - payload += encodeHost(remoteHost) + # use first 16 bytes if host data is longer + # for example in case of onion v3 service + payload += encodeHost(remoteHost)[:16] payload += pack('>H', remotePort) # remote IPv6 and port # bitflags of the services I offer.