Don't run off the end of a string.
Fixes https://gitlab.com/kicad/code/kicad/issues/7461
This commit is contained in:
parent
a475f45753
commit
02aca4a7d7
|
@ -169,8 +169,16 @@ wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject )
|
|||
size_t m = n + 1;
|
||||
wxUniChar str_m = str[m];
|
||||
|
||||
while( m < strlen && ( wxIsalnum( str_m ) || str_m == wxT( '_' ) || str_m == wxT( ':' ) ) )
|
||||
str_m = str[++m];
|
||||
while( wxIsalnum( str_m ) || str_m == wxT( '_' ) || str_m == wxT( ':' ) )
|
||||
{
|
||||
if( ++m == strlen )
|
||||
{
|
||||
str_m = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
str_m = str[m];
|
||||
}
|
||||
|
||||
wxString strVarName( str.c_str() + n + 1, m - n - 1 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue