Fix a possible out-of-bounds access to an array

This commit is contained in:
Lauri Nurmi
2016-10-24 21:56:11 +03:00
parent 7684f92083
commit de70fa5b2f

View File

@@ -1095,7 +1095,7 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode)
// returned string is capitalized and ended with '\r\n' - bad // returned string is capitalized and ended with '\r\n' - bad
s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]); s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]);
size_t len = wxStrlen(s_szBuf); size_t len = wxStrlen(s_szBuf);
if ( len > 0 ) { if ( len >= 2 ) {
// truncate string // truncate string
if ( s_szBuf[len - 2] == wxS('\r') ) if ( s_szBuf[len - 2] == wxS('\r') )
s_szBuf[len - 2] = wxS('\0'); s_szBuf[len - 2] = wxS('\0');