Author: toad
Date: 2008-04-10 15:58:24 +0000 (Thu, 10 Apr 2008)
New Revision: 19146

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
Log:
Prevent future bugs or malicious attack from causing a segfault by messing up 
the block counts.

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcher.java        
2008-04-10 15:22:18 UTC (rev 19145)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcher.java        
2008-04-10 15:58:24 UTC (rev 19146)
@@ -160,6 +160,10 @@
                                segments[i] = new 
SplitFileFetcherSegment(splitfileType, dataBlocks, checkBlocks, this, 
archiveContext, 
                                                fetchContext, maxTempLength, 
recursionLevel+1);
                        }
+                       if(dataBlocksPtr != splitfileDataBlocks.length)
+                               throw new 
FetchException(FetchException.INVALID_METADATA, "Unable to allocate all data 
blocks to segments - buggy or malicious inserter");
+                       if(checkBlocksPtr != splitfileCheckBlocks.length)
+                               throw new 
FetchException(FetchException.INVALID_METADATA, "Unable to allocate all check 
blocks to segments - buggy or malicious inserter");
                }
                this.token = token2;
                parent.addBlocks(splitfileDataBlocks.length + 
splitfileCheckBlocks.length);


Reply via email to