Changeset 9146f3c


Ignore:
Timestamp:
Mar 9, 2017 7:34:30 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
48a055d
Parents:
1fe9ace
Message:

i2psnark: Prevent RuntimeException? caused by corrupt i2psnark.dht.dat file
http://forum.i2p/viewtopic.php?t=12751

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/dht/NodeInfo.java

    r1fe9ace r9146f3c  
    107107            throw new DataFormatException("Bad format");
    108108        byte[] nid = Base64.decode(parts[0]);
    109         if (nid == null)
     109        if (nid == null || nid.length != NID.HASH_LENGTH)
    110110            throw new DataFormatException("Bad NID");
    111111        nID = new NID(nid);
    112112        byte[] h = Base64.decode(parts[1]);
    113         if (h == null)
     113        if (h == null || h.length != Hash.HASH_LENGTH)
    114114            throw new DataFormatException("Bad hash");
    115115        //hash = new Hash(h);
Note: See TracChangeset for help on using the changeset viewer.