Specify string size when creating wxString from const char*

wxString constructor will determine string length using strlen() when it
is not explicitly specified, but there is no termination byte added when
reading file contents to 'buffer' variable.
This commit is contained in:
Maciej Suminski 2018-09-14 09:59:57 +02:00
parent e5e1a315f1
commit b39bde0f0c
1 changed files with 1 additions and 1 deletions

View File

@ -624,7 +624,7 @@ int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* a
// read data // read data
std::vector<char> buffer( size ); std::vector<char> buffer( size );
cfgfile.Read( buffer.data(), size ); cfgfile.Read( buffer.data(), size );
wxString data( buffer.data(), wxConvUTF8 ); wxString data( buffer.data(), wxConvUTF8, size );
// Is this the wxConfig format? If so, remove "Keys=" and parse the newlines. // Is this the wxConfig format? If so, remove "Keys=" and parse the newlines.
if( data.StartsWith( wxT("Keys="), &data ) ) if( data.StartsWith( wxT("Keys="), &data ) )