GH124: Possible buffer overrun in EventLogChannel

This commit is contained in:
aleks-f 2013-03-12 23:13:02 -05:00
Родитель daef0aa403
Коммит ad66c4aac4
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -22,6 +22,7 @@ Release 1.5.2 (2013-03-??)
- added Recursive and SortedDirectoryIterator (Marian Krivos)
- added ListMap (map-like container with preserving insertion order)
- MailMessage: attachments saving support and consistent read/write
- fixed GH #124: Possibile buffer overrun in Foundation/EventLogChannel
Release 1.5.1 (2013-01-11)
==========================

Просмотреть файл

@ -56,9 +56,10 @@ EventLogChannel::EventLogChannel():
_logFile("Application"),
_h(0)
{
static const int length = 256;
#if defined(POCO_WIN32_UTF8)
wchar_t name[256];
int n = GetModuleFileNameW(NULL, name, sizeof(name));
wchar_t name[length];
int n = GetModuleFileNameW(NULL, name, length);
if (n > 0)
{
wchar_t* end = name + n - 1;
@ -68,8 +69,8 @@ EventLogChannel::EventLogChannel():
UnicodeConverter::toUTF8(uname, _name);
}
#else
char name[256];
int n = GetModuleFileNameA(NULL, name, sizeof(name));
char name[length];
int n = GetModuleFileNameA(NULL, name, length);
if (n > 0)
{
char* end = name + n - 1;