$OpenBSD: patch-src_common_string_cpp,v 1.1.1.1 2004/07/16 21:01:35 todd Exp $ --- src/common/string.cpp.orig 2003-09-20 20:24:26.000000000 +1000 +++ src/common/string.cpp 2003-10-04 13:24:11.000000000 +1000 @@ -1514,10 +1514,12 @@ wxString& wxString::insert(size_t nPos, if ( !str.IsEmpty() ) { wxString strTmp; - wxChar *pc = strTmp.GetWriteBuf(Len() + str.Len()); - wxStrncpy(pc, c_str(), nPos); - wxStrcpy(pc + nPos, str); - wxStrcpy(pc + nPos + str.Len(), c_str() + nPos); + size_t newLen = Len() + str.Len() + 1; + wxChar *pc = strTmp.GetWriteBuf(newLen); + strlcpy(pc, c_str(), newLen); + pc[nPos] = 0; + strlcat(pc, str, newLen); + strlcat(pc, c_str() + nPos, newLen); strTmp.UngetWriteBuf(); *this = strTmp; }