Do not allow port 0

Attackers injected node addresses with port 0 into the network. Port 0
is unusable on many OSes and can't be listened on. PyBitmessage won't
accept nodes that have port 0 anymore.
This commit is contained in:
Peter Šurda 2016-02-20 11:14:42 +01:00
parent 9239813ebb
commit b202ac6fab

View File

@ -581,6 +581,8 @@ class receiveDataThread(threading.Thread):
hostStandardFormat = self._checkIPAddress(fullHost)
if hostStandardFormat is False:
continue
if recaddrPort == 0:
continue
timeSomeoneElseReceivedMessageFromThisNode, = unpack('>Q', data[lengthOfNumberOfAddresses + (
38 * i):8 + lengthOfNumberOfAddresses + (38 * i)]) # This is the 'time' value in the received addr message. 64-bit.
if recaddrStream not in shared.knownNodes: # knownNodes is a dictionary of dictionaries with one outer dictionary for each stream. If the outer stream dictionary doesn't exist yet then we must make it.