diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index cbed32d72f..675ebdf2c0 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -243,12 +243,15 @@ size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const { - if ( buf == NULL ) + if ( !buf ) return false; wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); + if ( !buffer ) + return false; - strcpy( (char*)buf, buffer ); + memcpy( (char*) buf, buffer, GetDataSize(format) ); + // strcpy( (char*) buf, buffer ); return true; }