Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
- name: Setup SourcePawn compiler
uses: rumblefrog/setup-sp@v1.3.1
with:
version: "1.12.x"
# 1.13.0.7427 (production): 64-bit Address / LoadAddressFromAddress
version: "1.13.7427"
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions addons/sourcemod/gamedata/ServerCommandFilter.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
{
"library" "server"
"linux" "@_ZL19SendToServerConsolePKc"
"linux64" "@_ZL19SendToServerConsolePKc"
"windows" "\x55\x8B\xEC\x8B\x4D\x08\x85\xC9\x74\x2A\x83\x3D\x2A\x2A\x2A\x2A\x02"
}
"SetValue"
{
"library" "server"
"linux" "@_ZN21CScriptConvarAccessor8SetValueEPKc12CVariantBaseI24CVariantDefaultAllocatorE"
"linux64" "@_ZN21CScriptConvarAccessor8SetValueEPKc12CVariantBaseI24CVariantDefaultAllocatorE"
}
}
"Functions"
Expand Down
8 changes: 5 additions & 3 deletions addons/sourcemod/scripting/ServerCommandFilter.sp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Plugin myinfo =
name = "ServerCommandFilter",
author = "BotoX, .Rushaway, koen",
description = "Filters server commands using user-defined rules for maps (point_servercommand/VScript)",
version = "1.3.2",
version = "1.4.0",
url = "https://github.com/srcdslab/sm-plugin-ServerCommandFilter"
};

Expand Down Expand Up @@ -766,6 +766,7 @@ public MRESReturn Detour_SetValue(DHookParam hParams)
if (pVariant == Address_Null)
return MRES_Ignored;

// ScriptVariant_t: 8-byte value union, then int16 m_type (same layout on x86 and x86_64)
int iType = LoadFromAddress(pVariant + view_as<Address>(8), NumberType_Int16);
int iRawValue = LoadFromAddress(pVariant, NumberType_Int32);

Expand All @@ -783,11 +784,12 @@ public MRESReturn Detour_SetValue(DHookParam hParams)
}
case FIELD_CSTRING:
{
if (iRawValue == 0)
// m_pszString is a full pointer: 8 bytes on x86_64
Address pString = LoadAddressFromAddress(pVariant);
if (pString == Address_Null)
return MRES_Ignored; // Null string

char szStringValue[256];
Address pString = view_as<Address>(iRawValue);

bool bSuccess = false;
for (int i = 0; i < sizeof(szStringValue) - 1; i++)
Expand Down
Loading