Fixed possible crash when reloading a plugin with an invalid binary (bug 5288, r=psychonic).
This commit is contained in:
parent
c15a91dbcc
commit
6121c098c8
@ -1005,11 +1005,14 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
|||||||
pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err);
|
pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err);
|
||||||
if (pPlugin->m_pRuntime == NULL)
|
if (pPlugin->m_pRuntime == NULL)
|
||||||
{
|
{
|
||||||
UTIL_Format(error,
|
if (error)
|
||||||
maxlength,
|
{
|
||||||
"Unable to load plugin (error %d: %s)",
|
UTIL_Format(error,
|
||||||
err,
|
maxlength,
|
||||||
g_pSourcePawn2->GetErrorString(err));
|
"Unable to load plugin (error %d: %s)",
|
||||||
|
err,
|
||||||
|
g_pSourcePawn2->GetErrorString(err));
|
||||||
|
}
|
||||||
pPlugin->m_status = Plugin_BadLoad;
|
pPlugin->m_status = Plugin_BadLoad;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1020,7 +1023,10 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UTIL_Format(error, maxlength, "%s", pPlugin->m_errormsg);
|
if (error)
|
||||||
|
{
|
||||||
|
UTIL_Format(error, maxlength, "%s", pPlugin->m_errormsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user