From 232a3ab577cec9533acff89b5d6a4fcc1602756a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 4 Aug 2021 01:29:44 +0200 Subject: [PATCH] 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. --- src/common/regex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/regex.cpp b/src/common/regex.cpp index 7deddcbb02..c30556e5fe 100644 --- a/src/common/regex.cpp +++ b/src/common/regex.cpp @@ -444,7 +444,7 @@ wxString wxRegExImpl::GetErrorMsg(int errorcode) const int len = wx_regerror(errorcode, &m_RegEx, NULL, 0); if ( len > 0 ) { - wxCharTypeBuffer errbuf(len); + wxCharTypeBuffer errbuf(len + 1); (void)wx_regerror(errorcode, &m_RegEx, errbuf.data(), errbuf.length());