From d6adb8507ed0637686b92eeecd2ef0013d112a56 Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 9 Mar 2013 22:18:11 +0100 Subject: prevent crash if signature required for anonymous logon isn't found --- main.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 656d4ca..45662dd 100644 --- a/main.cpp +++ b/main.cpp @@ -579,15 +579,21 @@ bool CApplication::InitSteam() #ifdef _WIN32 void* pppUsePICS = steamclientScanner.FindSignature("\x00\x00\x00\x00\x83\x78\x34\x00\x75\x00\xc6\x81\x74\x0c\x00\x00\x00\x5d\xc2\x04\x00", "????xxxxx?xxxxxxxxxxx"); - g_pUsePICS = **(void***)pppUsePICS; + if(pppUsePICS) + g_pUsePICS = **(void***)pppUsePICS; #else unsigned char* pSig = (unsigned char*)steamclientScanner.FindSignature("\x55\x89\xE5\xE8\x00\x00\x00\x00\x81\xC1\x00\x00\x00\x00\x8B\x45\x08\x80\x7D\x0C\x00", "xxxx????xx????xxxxxxx"); - int uOffset = *(int*)(pSig + 10); - int uOffset2 = *(int*)(pSig + 34); + if(pSig) + { + int uOffset = *(int*)(pSig + 10); + int uOffset2 = *(int*)(pSig + 34); - void* ppUsePICS = pSig + 8 + uOffset + uOffset2; - g_pUsePICS = *(void**)ppUsePICS; + void* ppUsePICS = pSig + 8 + uOffset + uOffset2; + g_pUsePICS = *(void**)ppUsePICS; + } #endif + if(!g_pUsePICS) + Msg("Unable to find function signature required for anonymous logon. Anonymous logon is disabled\n"); const char* cszDir = commandLine.ParmValue("-dir"); if(cszDir) @@ -867,6 +873,11 @@ bool CApplication::LogOn() const char* cszUsername = commandLine.ParmValue("-username"); if(!cszUsername) { + if (!g_pUsePICS) + { + Error("Anonymous logon is disabled\n"); + return false; + } #ifdef _WIN32 void (__thiscall* pSetValue)(void* pThis, const char* cszValue) = (void (__thiscall *)(void *,const char *)) (*(void***)g_pUsePICS)[12]; #else -- cgit v1.2.3