user: Correct buffer overflows in IME processing code.

This commit is contained in:
Aric Stewart 2006-09-21 09:43:00 -05:00 committed by Alexandre Julliard
parent 966c5b6c0b
commit 5537fbbcff
1 changed files with 3 additions and 3 deletions

View File

@ -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)
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)
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");