mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-03 12:58:03 +01:00
Merge pull request #156 from mar-na/f154497a9f0f9b408917c07180cdf1e20a5647c6
Possible buffer overrun in Foundation/EventLogChannel
This commit is contained in:
commit
1cc5cd93f4
@ -56,7 +56,7 @@ EventLogChannel::EventLogChannel():
|
||||
_logFile("Application"),
|
||||
_h(0)
|
||||
{
|
||||
static const int length = 256;
|
||||
static const int length = MAX_PATH + 1;
|
||||
#if defined(POCO_WIN32_UTF8)
|
||||
wchar_t name[length];
|
||||
int n = GetModuleFileNameW(NULL, name, length);
|
||||
@ -289,8 +289,9 @@ std::wstring EventLogChannel::findLibrary(const wchar_t* name)
|
||||
HMODULE dll = LoadLibraryW(name);
|
||||
if (dll)
|
||||
{
|
||||
wchar_t name[MAX_PATH + 1];
|
||||
int n = GetModuleFileNameW(dll, name, sizeof(name));
|
||||
static const int length = MAX_PATH + 1;
|
||||
wchar_t name[length];
|
||||
int n = GetModuleFileNameW(dll, name, length);
|
||||
if (n > 0) path = name;
|
||||
FreeLibrary(dll);
|
||||
}
|
||||
@ -303,8 +304,9 @@ std::string EventLogChannel::findLibrary(const char* name)
|
||||
HMODULE dll = LoadLibraryA(name);
|
||||
if (dll)
|
||||
{
|
||||
char name[MAX_PATH + 1];
|
||||
int n = GetModuleFileNameA(dll, name, sizeof(name));
|
||||
static const int length = MAX_PATH + 1;
|
||||
char name[length];
|
||||
int n = GetModuleFileNameA(dll, name, length);
|
||||
if (n > 0) path = name;
|
||||
FreeLibrary(dll);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user