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:
parent
e5e1a315f1
commit
b39bde0f0c
|
@ -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 ) )
|
||||||
|
|
Loading…
Reference in New Issue