From 94133965c4c74dff4ed1f1c6fcce376a4d4dee9e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 28 Apr 2024 03:33:03 +0300 Subject: [PATCH] amxmodx: do not try to parse a signature starting with @ as hex Imagine a situation where `MemoryUtils::ResolveSymbol` for some reason fails. Then the signature gets parsed as a HEX value. The way the `MemoryUtils::DecodeHexString` (called by `MemoryUtils::DecodeAndFindPattern`) works is that it takes any symbols, checks if it's backslash and tries to parse it, otherwise it just silently puts into the buffer. The problem of this is that the `MemoryUtils::FindPattern` will look for any pattern match, despite it's not a pattern but a symbol name in an ASCII. This might lead to unwanted consequences, and to me, it's better fail here than crash. --- amxmodx/CGameConfigs.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/amxmodx/CGameConfigs.cpp b/amxmodx/CGameConfigs.cpp index 75d66109d2..5ff69f4791 100644 --- a/amxmodx/CGameConfigs.cpp +++ b/amxmodx/CGameConfigs.cpp @@ -584,8 +584,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states) } #endif } - - if (!finalAddress) + else { finalAddress = g_MemUtils.DecodeAndFindPattern(addressInBase, TempSig.signature); }