forked from I2P_Developers/i2p.i2p
i2psnark: Prevent RuntimeException caused by corrupt i2psnark.dht.dat file
http://forum.i2p/viewtopic.php?t=12751
This commit is contained in:
@ -106,11 +106,11 @@ class NodeInfo extends SimpleDataStructure {
|
|||||||
if (parts.length != 4)
|
if (parts.length != 4)
|
||||||
throw new DataFormatException("Bad format");
|
throw new DataFormatException("Bad format");
|
||||||
byte[] nid = Base64.decode(parts[0]);
|
byte[] nid = Base64.decode(parts[0]);
|
||||||
if (nid == null)
|
if (nid == null || nid.length != NID.HASH_LENGTH)
|
||||||
throw new DataFormatException("Bad NID");
|
throw new DataFormatException("Bad NID");
|
||||||
nID = new NID(nid);
|
nID = new NID(nid);
|
||||||
byte[] h = Base64.decode(parts[1]);
|
byte[] h = Base64.decode(parts[1]);
|
||||||
if (h == null)
|
if (h == null || h.length != Hash.HASH_LENGTH)
|
||||||
throw new DataFormatException("Bad hash");
|
throw new DataFormatException("Bad hash");
|
||||||
//hash = new Hash(h);
|
//hash = new Hash(h);
|
||||||
hash = Hash.create(h);
|
hash = Hash.create(h);
|
||||||
|
Reference in New Issue
Block a user