]> git.saurik.com Git - wxWidgets.git/commitdiff
properly NUL-terminate the string when using strncpy() (#10230)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 29 Nov 2008 13:43:32 +0000 (13:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 29 Nov 2008 13:43:32 +0000 (13:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp

index 4d7e28177af1fd4eb1cbc2cc26509473d6970cec..63c158daeb139caad10b4a8768c059f5f4d0acec 100644 (file)
@@ -2485,7 +2485,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()