fixed buffer overflow

removed useless LocalUnlock
fixed memory leak

svn path=/trunk/; revision=18521
This commit is contained in:
Christoph von Wittich 2005-10-17 15:17:54 +00:00
parent 643679edee
commit 7d087d74d1
3 changed files with 4 additions and 4 deletions

View file

@ -517,7 +517,7 @@ HEXEDIT_WM_NCDESTROY(PHEXEDIT_DATA hed)
{ {
if(hed->hBuffer) if(hed->hBuffer)
{ {
while(LocalUnlock(hed->hBuffer)); //while(LocalUnlock(hed->hBuffer));
LocalFree(hed->hBuffer); LocalFree(hed->hBuffer);
} }

View file

@ -223,7 +223,7 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
LPTSTR strBinary; LPTSTR strBinary;
if(dwCount > 0) if(dwCount > 0)
{ {
strBinary = HeapAlloc(GetProcessHeap(), 0, (dwCount * sizeof(TCHAR) * 3) + 1); strBinary = HeapAlloc(GetProcessHeap(), 0, (dwCount * sizeof(TCHAR) * 3) + sizeof(TCHAR));
for (i = 0; i < dwCount; i++) for (i = 0; i < dwCount; i++)
{ {
wsprintf( strBinary + i*3, _T("%02X "), pData[i] ); wsprintf( strBinary + i*3, _T("%02X "), pData[i] );

View file

@ -181,9 +181,9 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
goto done; goto done;
} }
tvItem.cchTextMax = dwMaxSubKeyLen; tvItem.cchTextMax = dwMaxSubKeyLen;
if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) { /*if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) {
goto done; goto done;
} }*/
/* Get all of the tree node siblings in one contiguous block of memory */ /* Get all of the tree node siblings in one contiguous block of memory */
{ {