fix rare ElGamal AIOOBE

This commit is contained in:
zzz
2009-10-09 16:00:38 +00:00
parent da41f3a93b
commit 3c260aa333
3 changed files with 8 additions and 5 deletions

View File

@ -181,16 +181,17 @@ public class ElGamalEngine {
for (i = 0; i < val.length; i++)
if (val[i] != (byte) 0x00) break;
//ByteArrayInputStream bais = new ByteArrayInputStream(val, i, val.length - i);
byte hashData[] = new byte[Hash.HASH_LENGTH];
System.arraycopy(val, i + 1, hashData, 0, Hash.HASH_LENGTH);
Hash hash = new Hash(hashData);
int payloadLen = val.length - i - 1 - Hash.HASH_LENGTH;
if (payloadLen < 0) {
if (_log.shouldLog(Log.ERROR))
_log.error("Decrypted data is too small (" + (val.length - i)+ ")");
return null;
}
//ByteArrayInputStream bais = new ByteArrayInputStream(val, i, val.length - i);
byte hashData[] = new byte[Hash.HASH_LENGTH];
System.arraycopy(val, i + 1, hashData, 0, Hash.HASH_LENGTH);
Hash hash = new Hash(hashData);
byte rv[] = new byte[payloadLen];
System.arraycopy(val, i + 1 + Hash.HASH_LENGTH, rv, 0, rv.length);

View File

@ -1,5 +1,7 @@
2009-10-09 zzz
* ElGamalEngine: Fix rare AIOOBE (thanks hottuna!)
* I2PTunnel: Fix persistent client tunnel keyfile location
* peers.jsp: Fix NTCP rate formatting (thanks hottuna!)
2009-10-09 dr|z3d
* Add paste.i2p2.i2p, and echelon's software links to readmes (thanks

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 25;
public final static long BUILD = 26;
/** for example "-test" */
public final static String EXTRA = "-rc";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;