Skip to content

Possibile buffer overrun in Foundation/EventLogChannel #124

@mar-na

Description

@mar-na

Hello,

I found in the current implementation (1.4.6) a possible buffer overrun in EventLogChannel.

EventLogChannel::EventLogChannel():
_logFile("Application"),
_h(0)
{
#if defined(POCO_WIN32_UTF8)
wchar_t name[256];
int n = GetModuleFileNameW(NULL, name, sizeof(name));
// ...
}
wchar_t name[256];
// -> array with 256 elements created
int n = GetModuleFileNameW(NULL, name, sizeof(name));
// -> Try to read 512 elements !!! because the length of one wchar_t is 2

Fixed version:

EventLogChannel::EventLogChannel():
_logFile("Application"),
_h(0)
{
static const int length = 256;
#if defined(POCO_WIN32_UTF8)
wchar_t name[length];
int n = GetModuleFileNameW(NULL, name, length);
// ...
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions