mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
WebParser: Fixed that RegExp matching fails if data contains embedded NULLs
This commit is contained in:
parent
e3bde6879b
commit
8ca0d0a830
@ -75,7 +75,7 @@ void ShowError(int lineNumber, WCHAR* errorMsg = NULL);
|
||||
unsigned __stdcall NetworkThreadProc(void* pParam);
|
||||
unsigned __stdcall NetworkDownloadThreadProc(void* pParam);
|
||||
void Log(int level, const WCHAR* string);
|
||||
void ParseData(UrlData* urlData, LPCSTR parseData);
|
||||
void ParseData(UrlData* urlData, LPCSTR parseData, DWORD dwSize);
|
||||
|
||||
CRITICAL_SECTION g_CriticalSection;
|
||||
bool g_Initialized = false;
|
||||
@ -828,7 +828,7 @@ unsigned __stdcall NetworkThreadProc(void* pParam)
|
||||
}
|
||||
}
|
||||
|
||||
ParseData(urlData, (LPCSTR)data);
|
||||
ParseData(urlData, (LPCSTR)data, dwSize);
|
||||
|
||||
delete [] data;
|
||||
}
|
||||
@ -841,10 +841,8 @@ unsigned __stdcall NetworkThreadProc(void* pParam)
|
||||
return 0; // thread completed successfully
|
||||
}
|
||||
|
||||
void ParseData(UrlData* urlData, LPCSTR parseData)
|
||||
void ParseData(UrlData* urlData, LPCSTR parseData, DWORD dwSize)
|
||||
{
|
||||
size_t dwSize = 0;
|
||||
|
||||
// Parse the value from the data
|
||||
pcre* re;
|
||||
const char* error;
|
||||
@ -884,8 +882,6 @@ void ParseData(UrlData* urlData, LPCSTR parseData)
|
||||
parseData = utf8Data.c_str();
|
||||
}
|
||||
|
||||
dwSize = strlen(parseData);
|
||||
|
||||
rc = pcre_exec(
|
||||
re, // the compiled pattern
|
||||
NULL, // no extra data - we didn't study the pattern
|
||||
@ -987,7 +983,7 @@ void ParseData(UrlData* urlData, LPCSTR parseData)
|
||||
// Change the index and parse the substring
|
||||
int index = (*i).second->stringIndex;
|
||||
(*i).second->stringIndex = (*i).second->stringIndex2;
|
||||
ParseData((*i).second, szResult.c_str());
|
||||
ParseData((*i).second, szResult.c_str(), szResult.length());
|
||||
(*i).second->stringIndex = index;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user