diff --git a/docs/changes.txt b/docs/changes.txt index e9f8b2de11..173869152d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -639,6 +639,7 @@ wxMSW: wxOSX: +- Fix buffer overrun in drag-and-drop code (Kristian Duske). - Fix incorrect joystick detection in configure (Lauri Nurmi). - Fix crash in wxDataViewCtrl when cancelling choice selection (hartwigw). - Implement support for wxGA_VERTICAL in wxGauge (themindiswatching). diff --git a/src/osx/dnd_osx.cpp b/src/osx/dnd_osx.cpp index ab6f153b53..4170c5a5cf 100644 --- a/src/osx/dnd_osx.cpp +++ b/src/osx/dnd_osx.cpp @@ -129,10 +129,9 @@ bool wxDropTarget::GetData() } else { - char *d = new char[size]; - data->GetDataHere( format, (void*)d ); - m_dataObject->SetData( format, size, d ); - delete [] d; + wxCharBuffer d(size); + data->GetDataHere( format, d.data() ); + m_dataObject->SetData( format, size, d.data() ); } } }