From 52962f1b97fc081c96b6bbe11b5b9f1fe4c848af Mon Sep 17 00:00:00 2001 From: Ske Date: Fri, 19 Jul 2019 02:14:46 +0200 Subject: [PATCH] Bounds check proxy tags before extracting inner message --- PluralKit.Bot/Services/ProxyService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PluralKit.Bot/Services/ProxyService.cs b/PluralKit.Bot/Services/ProxyService.cs index eb284ae9..b7d1f367 100644 --- a/PluralKit.Bot/Services/ProxyService.cs +++ b/PluralKit.Bot/Services/ProxyService.cs @@ -72,7 +72,7 @@ namespace PluralKit.Bot var prefix = potential.Member.Prefix ?? ""; var suffix = potential.Member.Suffix ?? ""; - if (message.StartsWith(prefix) && message.EndsWith(suffix)) { + if (message.Length >= prefix.Length + suffix.Length && message.StartsWith(prefix) && message.EndsWith(suffix)) { var inner = message.Substring(prefix.Length, message.Length - prefix.Length - suffix.Length); if (leadingMention != null) inner = $"{leadingMention} {inner}"; return new ProxyMatch { Member = potential.Member, System = potential.System, InnerText = inner };