mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-25 18:22:59 +02:00 
			
		
		
		
	Possible buffer overrun in Foundation/EventLogChannel
This commit is contained in:
		| @@ -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); | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 mar-na
					mar-na