mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
* [GuiInspectorField] BugFix: Correct data corruption potential caused by casting the result of Con::evaluatef directly to a const char.
This commit is contained in:
parent
31c8d3ce3a
commit
f1a48df676
1 changed files with 5 additions and 4 deletions
|
|
@ -318,7 +318,8 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
|
||||||
{
|
{
|
||||||
char buffer[ 2048 ];
|
char buffer[ 2048 ];
|
||||||
expandEscape( buffer, newValue );
|
expandEscape( buffer, newValue );
|
||||||
newValue = (const char*)Con::evaluatef( "$f = \"%s\"; return ( %s );", oldValue.c_str(), buffer );
|
ConsoleValue result = Con::evaluatef("$f = \"%s\"; return ( %s );", oldValue.c_str(), buffer);
|
||||||
|
newValue = result.getString();
|
||||||
Con::evaluatef("$f=0;");
|
Con::evaluatef("$f=0;");
|
||||||
}
|
}
|
||||||
else if( type == TypeS32Vector
|
else if( type == TypeS32Vector
|
||||||
|
|
@ -354,13 +355,13 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
|
||||||
char buffer[ 2048 ];
|
char buffer[ 2048 ];
|
||||||
expandEscape( buffer, newComponentExpr );
|
expandEscape( buffer, newComponentExpr );
|
||||||
|
|
||||||
const char* newComponentVal = Con::evaluatef( "$f = \"%s\"; $v = \"%s\"; return ( %s );",
|
ConsoleValue result = Con::evaluatef("$f = \"%s\"; $v = \"%s\"; return ( %s );",
|
||||||
oldComponentVal, oldValue.c_str(), buffer );
|
oldComponentVal, oldValue.c_str(), buffer);
|
||||||
Con::evaluatef("$f=0;$v=0;");
|
Con::evaluatef("$f=0;$v=0;");
|
||||||
|
|
||||||
if( !isFirst )
|
if( !isFirst )
|
||||||
strNew.append( ' ' );
|
strNew.append( ' ' );
|
||||||
strNew.append( newComponentVal );
|
strNew.append( result.getString() );
|
||||||
|
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue