[QuickPatch] Fix invalid name check

This commit is contained in:
momo5502 2018-11-19 21:08:23 +01:00
parent 3a9d8da1f1
commit b2cb5f7394
2 changed files with 7 additions and 7 deletions

View File

@ -119,13 +119,15 @@ namespace Components
}
}
int QuickPatch::InvalidNameCheck(char *dest, char *source, int size)
bool QuickPatch::InvalidNameCheck(char *dest, char *source, int size)
{
strncpy(dest, source, size - 1);
dest[size - 1] = 0;
for (int i = 0; i < size - 1; i++)
{
if (!dest[i]) break;
if (dest[i] > 125 || dest[i] < 32)
{
return false;
@ -133,7 +135,6 @@ namespace Components
}
return true;
}
__declspec(naked) void QuickPatch::InvalidNameStub()
@ -143,11 +144,10 @@ namespace Components
__asm
{
call InvalidNameCheck;
cmp eax, 1;
test al, al
jne invalidName;
jnz returnSafe;
invalidName:
pushad;
push 1;
push kick_reason;
@ -157,7 +157,7 @@ namespace Components
add esp, 12;
popad;
// return
returnSafe:
push 0x00401988;
retn;
}

View File

@ -27,7 +27,7 @@ namespace Components
static void JavelinResetHookStub();
static int QuickPatch::InvalidNameCheck(char *dest, char *source, int size);
static bool QuickPatch::InvalidNameCheck(char *dest, char *source, int size);
static void QuickPatch::InvalidNameStub();
};
}