Commit 5537fbbc authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

user: Correct buffer overflows in IME processing code.

parent 966c5b6c
...@@ -5341,7 +5341,7 @@ static void EDIT_GetCompositionStr(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) ...@@ -5341,7 +5341,7 @@ static void EDIT_GetCompositionStr(HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
return; return;
} }
lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen); lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR));
if (!lpCompStr) if (!lpCompStr)
{ {
ERR("Unable to allocate IME CompositionString\n"); ERR("Unable to allocate IME CompositionString\n");
...@@ -5362,7 +5362,7 @@ static void EDIT_GetCompositionStr(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) ...@@ -5362,7 +5362,7 @@ static void EDIT_GetCompositionStr(HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
if (dwBufLenAttr) if (dwBufLenAttr)
{ {
dwBufLenAttr ++; dwBufLenAttr ++;
lpCompStrAttr = HeapAlloc(GetProcessHeap(),0,dwBufLenAttr); lpCompStrAttr = HeapAlloc(GetProcessHeap(),0,dwBufLenAttr+1);
if (!lpCompStrAttr) if (!lpCompStrAttr)
{ {
ERR("Unable to allocate IME Attribute String\n"); ERR("Unable to allocate IME Attribute String\n");
...@@ -5417,7 +5417,7 @@ static void EDIT_GetResultStr(HWND hwnd, EDITSTATE *es) ...@@ -5417,7 +5417,7 @@ static void EDIT_GetResultStr(HWND hwnd, EDITSTATE *es)
return; return;
} }
lpResultStr = HeapAlloc(GetProcessHeap(),0, dwBufLen); lpResultStr = HeapAlloc(GetProcessHeap(),0, dwBufLen+sizeof(WCHAR));
if (!lpResultStr) if (!lpResultStr)
{ {
ERR("Unable to alloc buffer for IME string\n"); ERR("Unable to alloc buffer for IME string\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment