mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-10-22 19:43:11 +00:00
* NetDB: Add hash collision detection
This commit is contained in:
1 parent
612fab1b2a
commit
85fbbf8980
1 file changed
+8
@@ -676,6 +676,10 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||
throw new IllegalArgumentException("Attempt to replace RI with " + leaseSet);
|
||||
}
|
||||
|
||||
// spoof / hash collision detection
|
||||
if (rv != null && !leaseSet.getDestination().equals(rv.getDestination()))
|
||||
throw new IllegalArgumentException("LS Hash collision");
|
||||
|
||||
String err = validate(key, leaseSet);
|
||||
if (err != null)
|
||||
throw new IllegalArgumentException("Invalid store attempt - " + err);
|
||||
@@ -815,6 +819,10 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||
throw new IllegalArgumentException("Attempt to replace LS with " + routerInfo);
|
||||
}
|
||||
|
||||
// spoof / hash collision detection
|
||||
if (rv != null && !routerInfo.getIdentity().equals(rv.getIdentity()))
|
||||
throw new IllegalArgumentException("RI Hash collision");
|
||||
|
||||
String err = validate(key, routerInfo);
|
||||
if (err != null)
|
||||
throw new IllegalArgumentException("Invalid store attempt - " + err);
|
||||
|
||||
Reference in new issue
Block a user