Merge pull request #1619 from joeedh/master

Fixed heap overrun error
This commit is contained in:
zilmar 2019-04-28 19:05:17 +09:30 committed by GitHub
commit 8088065ef8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -70,7 +70,7 @@ const char* CScriptSystem::APIScript()
void CScriptSystem::RunScript(char* path) void CScriptSystem::RunScript(char* path)
{ {
CScriptInstance* scriptInstance = new CScriptInstance(m_Debugger); CScriptInstance* scriptInstance = new CScriptInstance(m_Debugger);
char* pathSaved = (char*)malloc(strlen(path)); // freed via DeleteStoppedInstances char* pathSaved = (char*)malloc(strlen(path)+1); // freed via DeleteStoppedInstances
strcpy(pathSaved, path); strcpy(pathSaved, path);
m_RunningInstances.push_back({ pathSaved, scriptInstance }); m_RunningInstances.push_back({ pathSaved, scriptInstance });
scriptInstance->Start(pathSaved); scriptInstance->Start(pathSaved);