Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix for HTCache organisation that may have caused unlimited grow of the cache appeared only for tree-caches

orbitera5d388bfff28
diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java
index 1037f6f28..e46be8e6f 100644
--- a/source/de/anomic/plasma/plasmaHTCache.java
+++ b/source/de/anomic/plasma/plasmaHTCache.java
@@ -809,11 +809,13 @@ public final class plasmaHTCache {
/**
- * This is a helper funktion that extracts the Hash from the filename
+ * This is a helper function that extracts the Hash from the filename
*/
public static String getHash(final File f) {
if ((!f.isFile()) || (f.getPath().indexOf("hash") < 0)) return null;
- String hexHash = f.getName().substring(0,18);
+ String name = f.getName();
+ if (name.length() < 18) return null; // not a hash file name
+ String hexHash = name.substring(0,18);
if (hexHash.indexOf('.') >= 0) return null;
try {
String hash = kelondroBase64Order.enhancedCoder.encode(serverCodings.decodeHex(hexHash));