From cac2acb6c092c157f055550443f98dbc8ecfdb20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 7 Jan 2011 22:48:02 +0100 Subject: [PATCH] Prevent crash on more invalid links. --- src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java index fe602c6..63f68b8 100644 --- a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java +++ b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java @@ -169,7 +169,7 @@ public class FreenetLinkParser implements Parser { if ((linkType == LinkType.SSK) || (linkType == LinkType.USK)) { try { new FreenetURI(link); - fromPostingSone = link.substring(4, 47).equals(context.getPostingSone().getId()); + fromPostingSone = link.substring(4, Math.min(link.length(), 47)).equals(context.getPostingSone().getId()); parts.add(fromPostingSone ? createTrustedFreenetLinkPart(link, name) : createFreenetLinkPart(link, name)); } catch (MalformedURLException mue1) { /* it’s not a valid link. */ -- 2.7.4