[PATCH] wineconsole: Do not truncate argument strings larger than 256 bytes
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Apr 8 01:08:08 CDT 2015
For https://bugs.winehq.org/show_bug.cgi?id=34814
---
programs/wineconsole/wineconsole.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c
index 3c2faf5..ed5f816 100644
--- a/programs/wineconsole/wineconsole.c
+++ b/programs/wineconsole/wineconsole.c
@@ -830,13 +830,24 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
break;
case from_process_name:
{
- WCHAR buffer[256];
+ int len;
+ WCHAR *buffer;
- MultiByteToWideChar(CP_ACP, 0, wci.ptr, -1, buffer, sizeof(buffer) / sizeof(buffer[0]));
+ len = MultiByteToWideChar(CP_ACP, 0, wci.ptr, -1, NULL, 0);
+
+ buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ if (!buffer)
+ return 0;
+
+ MultiByteToWideChar(CP_ACP, 0, wci.ptr, -1, buffer, len);
if (!(data = WINECON_Init(hInst, GetCurrentProcessId(), buffer, wci.backend, nCmdShow)))
+ {
+ HeapFree(GetProcessHeap(), 0, buffer);
return 0;
+ }
ret = WINECON_Spawn(data, buffer);
+ HeapFree(GetProcessHeap(), 0, buffer);
if (!ret)
{
WINECON_Delete(data);
--
1.9.1
More information about the wine-patches
mailing list