SetCompressorStats must zero terminate the buffer from EM_GETLINE!

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6560 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2014-10-23 15:34:10 +00:00
parent 9eb4035b08
commit 9152c24610
3 changed files with 13 additions and 18 deletions

View file

@ -186,7 +186,7 @@ void SetDialogFocus(HWND hDlg, HWND hCtl)
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hCtl, TRUE);
}
void Items(HWND hwnd, int on)
void EnableDisableItems(HWND hwnd, int on)
{
const HWND hCloseBtn = GetDlgItem(hwnd, IDCANCEL);
const HWND hTestBtn = GetDlgItem(hwnd, IDC_TEST);
@ -234,12 +234,12 @@ void SetCompressorStats()
line_count = SendDlgItemMessage(g_sdata.hwnd, IDC_LOGWIN, EM_GETLINECOUNT, 0, 0);
for(i=0; i<line_count; i++) {
*((LPWORD)buf) = sizeof(buf);
SendDlgItemMessage(g_sdata.hwnd, IDC_LOGWIN, EM_GETLINE, (WPARAM)i, (LPARAM)buf);
*((LPWORD)buf) = ARRAYSIZE(buf);
LRESULT cchLine = SendDlgItemMessage(g_sdata.hwnd, IDC_LOGWIN, EM_GETLINE, (WPARAM)i, (LPARAM)buf);
buf[cchLine] = _T('\0');
if(found) {
DWORD len = lstrlen(TOTAL_SIZE_COMPRESSOR_STAT);
lstrcat(g_sdata.compressor_stats,buf);
if(!StrCmpN(buf,TOTAL_SIZE_COMPRESSOR_STAT,len)) {
break;
}