From 05c7601f1e20a1b0c9ef50880e901b5e201944ed Mon Sep 17 00:00:00 2001 From: Juice Date: Fri, 11 Jun 2021 20:01:01 +0300 Subject: [PATCH] Fix crash in ProcessStringCmd (#838) --- rehlds/HLTV/Proxy/src/ProxyClient.cpp | 5 +++++ rehlds/HLTV/common/BaseClient.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/rehlds/HLTV/Proxy/src/ProxyClient.cpp b/rehlds/HLTV/Proxy/src/ProxyClient.cpp index 82bdd27..2e47233 100644 --- a/rehlds/HLTV/Proxy/src/ProxyClient.cpp +++ b/rehlds/HLTV/Proxy/src/ProxyClient.cpp @@ -86,6 +86,11 @@ bool ProxyClient::ProcessStringCmd(char *string) return true; } + if (!cmdLine.CountToken()) { + m_System->DPrintf("WARNING! ProxyClient::ProcessStringCmd: invalid command string.\n"); + return false; + } + char *cmd = cmdLine.GetToken(0); for (auto& local_cmd : m_LocalCmdReg) { diff --git a/rehlds/HLTV/common/BaseClient.cpp b/rehlds/HLTV/common/BaseClient.cpp index 0c3a433..9f10489 100644 --- a/rehlds/HLTV/common/BaseClient.cpp +++ b/rehlds/HLTV/common/BaseClient.cpp @@ -266,6 +266,11 @@ bool BaseClient::ProcessStringCmd(char *string) return false; } + if (!cmdLine.CountToken()) { + m_System->DPrintf("WARNING! BaseClient::ProcessStringCmd: invalid command string.\n"); + return false; + } + char *cmd = cmdLine.GetToken(0); for (auto& local_cmd : m_LocalCmdReg) {