Author: toad
Date: 2007-12-19 16:30:48 +0000 (Wed, 19 Dec 2007)
New Revision: 16720

Modified:
   trunk/freenet/src/freenet/node/FNPPacketMangler.java
Log:
Include it if bothNoderefs = true. Prevent a NegativeArraySizeException.

Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java        2007-12-19 
16:26:50 UTC (rev 16719)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java        2007-12-19 
16:30:48 UTC (rev 16720)
@@ -1217,7 +1217,8 @@

                final int expectedLength =      HASH_LENGTH + // HMAC of the 
cyphertext
                                                                        
(c.getBlockSize() >> 3) + // IV
-                                                                       
HASH_LENGTH // the signature
+                                                                       
HASH_LENGTH + // the signature
+                                                                       
(bothNoderefs ? pn.jfkMyRef.length : 0) // my reference
                                                                        ;
                if(payload.length < expectedLength + 3) {
                        Logger.error(this, "Packet too short from 
"+pn.getPeer()+": "+payload.length+" after decryption in JFK(4), should be 
"+(expectedLength + 3));


Reply via email to