From 42d4f30156f9646c409138b7ae6dafef1115664f Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Sun, 5 Dec 1999 23:11:47 +0000 Subject: [PATCH] Whenever we do an strncpy we should make sure we put a '\0' at the end of the buffer. --- dlls/comctl32/listview.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 5d8af567c88..778e1065ad3 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -3609,10 +3609,12 @@ static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem) Str_SetPtrA(&lpItem->pszText, dispInfo.item.pszText); } strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); + lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; } else if (lpLVItem->mask & LVIF_TEXT) { strncpy(lpLVItem->pszText, lpItem->pszText, lpLVItem->cchTextMax); + lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; } if (dispInfo.item.mask & LVIF_STATE) @@ -3704,10 +3706,12 @@ static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem) Str_SetPtrA(&lpSubItem->pszText, dispInfo.item.pszText); } strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); + lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; } else if (lpLVItem->mask & LVIF_TEXT) { strncpy(lpLVItem->pszText, lpSubItem->pszText, lpLVItem->cchTextMax); + lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; } } }