From 0de284cd3658d233f6c6e6d7609a9d4726342874 Mon Sep 17 00:00:00 2001 From: Ske Date: Tue, 11 Aug 2020 22:05:27 +0200 Subject: [PATCH] Bounds check system name in new system command --- PluralKit.Bot/Commands/System.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Commands/System.cs b/PluralKit.Bot/Commands/System.cs index 2fde9b66..4923adac 100644 --- a/PluralKit.Bot/Commands/System.cs +++ b/PluralKit.Bot/Commands/System.cs @@ -25,7 +25,11 @@ namespace PluralKit.Bot { ctx.CheckNoSystem(); - var system = await _data.CreateSystem(ctx.RemainderOrNull()); + var systemName = ctx.RemainderOrNull(); + if (systemName != null && systemName.Length > Limits.MaxSystemNameLength) + throw Errors.SystemNameTooLongError(systemName.Length); + + var system = await _data.CreateSystem(systemName); await _data.AddAccount(system, ctx.Author.Id); await ctx.Reply($"{Emojis.Success} Your system has been created. Type `pk;system` to view it, and type `pk;system help` for more information about commands you can use now. Now that you have that set up, check out the getting started guide on setting up members and proxies: "); }