Allocate more space for the wxRegEx error message buffer
We need to account for the trailing NUL explicitly here, so add 1 to the length returned by the first call to wx_regerror() to avoid chopping off the last character of the error message.
This commit is contained in:
@@ -444,7 +444,7 @@ wxString wxRegExImpl::GetErrorMsg(int errorcode) const
|
|||||||
int len = wx_regerror(errorcode, &m_RegEx, NULL, 0);
|
int len = wx_regerror(errorcode, &m_RegEx, NULL, 0);
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
{
|
{
|
||||||
wxCharTypeBuffer<wxRegErrorChar> errbuf(len);
|
wxCharTypeBuffer<wxRegErrorChar> errbuf(len + 1);
|
||||||
|
|
||||||
(void)wx_regerror(errorcode, &m_RegEx, errbuf.data(), errbuf.length());
|
(void)wx_regerror(errorcode, &m_RegEx, errbuf.data(), errbuf.length());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user