more reliable shino hook

This commit is contained in:
Akash Mozumdar 2019-05-07 05:42:35 -04:00
parent fbe190f39c
commit 0a50a9b70d

View File

@ -5763,15 +5763,15 @@ int GetShinaRioVersion()
if (hFile != INVALID_HANDLE_VALUE) { if (hFile != INVALID_HANDLE_VALUE) {
//char *buffer,*version;//,*ptr; //char *buffer,*version;//,*ptr;
enum { BufferSize = 0x40 }; enum { BufferSize = 0x40 };
char buffer[BufferSize]; char buffer[BufferSize]{};
DWORD DUMMY; DWORD DUMMY;
ReadFile(hFile, buffer, BufferSize, &DUMMY, nullptr); ReadFile(hFile, buffer, BufferSize, &DUMMY, nullptr);
CloseHandle(hFile); CloseHandle(hFile);
if (buffer[0] == '[') { //if (buffer[0] == '[') {
buffer[0x3f] = 0; // jichi 8/24/2013: prevent strstr from overflow buffer[0x3f] = 0; // jichi 8/24/2013: prevent strstr from overflow
if (char *version = ::strstr(buffer, "v2.")) if (char *version = ::strstr(buffer, "v2."))
::sscanf(version + 3, "%d", &ret); // +3 to skip "v2." ::sscanf(version + 3, "%d", &ret); // +3 to skip "v2."
} //}
} }
return ret; return ret;
} }