properly NUL-terminate the string when using strncpy() (#10230)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@57021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-11-29 13:43:32 +00:00
parent 2f4390c06b
commit e8b7069659

View File

@@ -2373,7 +2373,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if ( lvi.mask & LVIF_TEXT )
{
wxString text = OnGetItemText(item, lvi.iSubItem);
wxStrncpy(lvi.pszText, text, lvi.cchTextMax);
wxStrncpy(lvi.pszText, text, lvi.cchTextMax - 1);
lvi.pszText[lvi.cchTextMax - 1] = _T('\0');
}
// see comment at the end of wxListCtrl::GetColumn()