alliedmodders / amxmodx

AMX Mod X - Half-Life 1 Scripting and Administration
http://www.amxmodx.org/
478 stars 198 forks source link

amxmodx: do not try to parse a signature starting with @ as hex #1099

Open a1batross opened 2 months ago

a1batross commented 2 months ago

Imagine a situation where MemoryUtils::ResolveSymbol for some reason fails. (not yet supported engine for example ( ͡° ͜ʖ ͡°))

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.