diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index cde7db8f80..cea77fd9cf 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -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()