NodeAddress::Null

Hi everyone,

By doing the unit test of class NodeCache, I have found, if I try to add a node with the address 0.0.0.0:200, it will be added successfully.

The assert Q_ASSERT (nodeInfo.address != NodeAddress::Null); will not find it, because the NodeAddress::Null is the address 0.0.0.0:0.

But 0.0.0.0:200 is also an invalid address, and there are many other invalid addresses. Because these addresses are received from other peers, so they should be checked, at least they should be valid.

I think we can modify the constructor of the class NodeAddress. It sets all invalid addresses to 0.0.0.0:0. Then the “users” of class NodeCache should verify the address, before adding it to the cache.

Best regards,

Bo

Would you like to post a relpy?


This post starts a thread.
Follow-ups:
Re: NodeAddress::Null
Hi Bo, I think it was possible to receive a NodeAddress in a Pong packet from a Gnutella leaf that has a zero IP address and non-zero port. In that case (more...)