From 2f9501fa1aafb86cc8d6be1d041abfe1b30c225a Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sat, 20 Feb 2016 11:14:42 +0100 Subject: [PATCH] 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. --- src/class_receiveDataThread.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/class_receiveDataThread.py b/src/class_receiveDataThread.py index 38b9aafe..e2a25a3e 100644 --- a/src/class_receiveDataThread.py +++ b/src/class_receiveDataThread.py @@ -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.