diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-03 22:33:56 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-03 22:33:56 +0100 |
| commit | 1ce7a7d3862bed06e27ffbafb92dac6a26bfba7b (patch) | |
| tree | f8ddbc02cb6ccf7a069197612467a327c206a87a /src/netvars.cpp | |
| parent | World: add Fullbright visual feature (diff) | |
| download | hl2h-1ce7a7d3862bed06e27ffbafb92dac6a26bfba7b.tar.gz hl2h-1ce7a7d3862bed06e27ffbafb92dac6a26bfba7b.zip | |
Fix startup crash: use ClientCmd for fullbright; sanitize owner netvars
- Poking VEngineCvar004/ConVar vtables directly crashed before the main menu
(ConVar uses a secondary IConVar vtable). Use the stable IVEngineClient
ClientCmd slot 7 for mat_fullbright instead.
- Reject out-of-range m_hOwnerEntity/m_hOwner offsets: the resolver found a
bogus negative owner offset (-136296061), which could make item-ESP weapon
ownership read wild memory.
Diffstat (limited to '')
| -rw-r--r-- | src/netvars.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/netvars.cpp b/src/netvars.cpp index adb5a6a..834aa2f 100644 --- a/src/netvars.cpp +++ b/src/netvars.cpp | |||
| @@ -93,9 +93,13 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) { | |||
| 93 | g_net.activeweapon < 0) { | 93 | g_net.activeweapon < 0) { |
| 94 | g_net.activeweapon = (int)(base_off + (uint32_t)poff); | 94 | g_net.activeweapon = (int)(base_off + (uint32_t)poff); |
| 95 | } else if (strcmp(pname2, "m_hOwnerEntity") == 0 && g_net.owner < 0) { | 95 | } else if (strcmp(pname2, "m_hOwnerEntity") == 0 && g_net.owner < 0) { |
| 96 | g_net.owner = (int)(base_off + (uint32_t)poff); | 96 | int off = (int)(base_off + (uint32_t)poff); |
| 97 | if (off > 0 && off < 0x2000) | ||
| 98 | g_net.owner = off; | ||
| 97 | } else if (strcmp(pname2, "m_hOwner") == 0 && g_net.weapon_owner < 0) { | 99 | } else if (strcmp(pname2, "m_hOwner") == 0 && g_net.weapon_owner < 0) { |
| 98 | g_net.weapon_owner = (int)(base_off + (uint32_t)poff); | 100 | int off = (int)(base_off + (uint32_t)poff); |
| 101 | if (off > 0 && off < 0x2000) | ||
| 102 | g_net.weapon_owner = off; | ||
| 99 | } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) { | 103 | } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) { |
| 100 | g_net.teamnum = (int)(base_off + (uint32_t)poff); | 104 | g_net.teamnum = (int)(base_off + (uint32_t)poff); |
| 101 | } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) { | 105 | } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) { |
