I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit bfb55570 authored by zzz's avatar zzz
Browse files

i2ptunnel: Additional fixes for invalid entries in filter file (Gitlab #483)

as reported by drzed
parent 6b6335ce
No related branches found
No related tags found
No related merge requests found
Pipeline #1892 passed
...@@ -33,9 +33,14 @@ abstract class FilterDefinitionElement { ...@@ -33,9 +33,14 @@ abstract class FilterDefinitionElement {
* Utility method to create a Hash object from a .b32 string * Utility method to create a Hash object from a .b32 string
*/ */
protected static Hash fromBase32(String b32) throws InvalidDefinitionException { protected static Hash fromBase32(String b32) throws InvalidDefinitionException {
if (b32.length() != 60)
throw new InvalidDefinitionException("Invalid b32 " + b32);
if (!b32.endsWith(".b32.i2p")) if (!b32.endsWith(".b32.i2p"))
throw new InvalidDefinitionException("Invalid b32 " + b32); throw new InvalidDefinitionException("Invalid b32 " + b32);
b32 = b32.substring(0, b32.length() - 8); String s = b32.substring(0, 52);
return new Hash(Base32.decode(b32)); byte[] b = Base32.decode(s);
if (b == null)
throw new InvalidDefinitionException("Invalid b32 " + b32);
return Hash.create(b);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment