From a4194c38d87f8e72b9de12dc6f999083f1c7e3f4 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 24 Apr 2025 12:33:53 -0400 Subject: [PATCH] validate that CHATHISTORY limit parameters are nonnegative See #2248. Reported by @prdes --- irc/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc/handlers.go b/irc/handlers.go index 3dd6ba40..2256af79 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -765,7 +765,7 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.Message, rb * return maxChathistoryLimit } limit, err := strconv.Atoi(msg.Params[paramIndex]) - if err != nil || limit == 0 || limit > maxChathistoryLimit { + if err != nil || limit <= 0 || limit > maxChathistoryLimit { limit = maxChathistoryLimit } return