From 90bfbeb38dba23edf83e1a70a2aa6e9a38e26397 Mon Sep 17 00:00:00 2001 From: muxator Date: Wed, 27 Feb 2019 00:56:41 +0100 Subject: [PATCH] PadMessageHandler.js: fixed logic error in a guard condition The guard condition on count being non negative and < 100 used the wrong boolean operator. In its form it was impossible. This error was introduced in 2013, in 5592c4b0feb42082ab50e1c90753c28e5cd79334. Fixes #3499 --- src/node/handler/PadMessageHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 1455660c1..5581dbeb9 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -462,9 +462,9 @@ function handleGetChatMessages(client, message) var start = message.data.start; var end = message.data.end; - var count = start - count; + var count = end - start; - if(count < 0 && count > 100) + if(count < 0 || count > 100) { messageLogger.warn("Dropped message, GetChatMessages Message, client requested invalid amout of messages!"); return;