From 046fce4786167528e1f15319a3e08a405a2b891d Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Thu, 9 Oct 2008 17:00:32 +0000 Subject: [PATCH] fixed a bug caused by passing a wxChar[] buffer to a function taking a wxString; the buffer was automatically converted but since it was not NULL-terminated, a crash resulted git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextbuffer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 3b3e0e0386..8c75c513df 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -7588,7 +7588,10 @@ bool wxRichTextImageBlock::ReadHex(wxInputStream& stream, int length, wxBitmapTy if (m_data) delete[] m_data; - wxChar str[2]; + // create a null terminated temporary string: + char str[3]; + str[2] = '\0'; + m_data = new unsigned char[dataSize]; int i; for (i = 0; i < dataSize; i ++) -- 2.47.2