Added many missing handle security checks (bug 5595, r=psychonic).
--HG-- extra : rebase_source : cc5bf3057bbce89fc14bff9c673821c3146c588b
This commit is contained in:
@@ -187,8 +187,9 @@ static cell_t sm_GetForwardFunctionCount(IPluginContext *pContext, const cell_t
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError err;
|
||||
IForward *pForward;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward))
|
||||
if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, &sec, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid forward handle %x (error %d)", hndl, err);
|
||||
@@ -204,8 +205,9 @@ static cell_t sm_AddToForward(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
IChangeableForward *pForward;
|
||||
IPlugin *pPlugin;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, &sec, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
|
||||
@@ -240,8 +242,9 @@ static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *param
|
||||
HandleError err;
|
||||
IChangeableForward *pForward;
|
||||
IPlugin *pPlugin;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, &sec, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
|
||||
@@ -276,8 +279,9 @@ static cell_t sm_RemoveAllFromForward(IPluginContext *pContext, const cell_t *pa
|
||||
HandleError err;
|
||||
IChangeableForward *pForward;
|
||||
IPlugin *pPlugin;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
|
||||
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, &sec, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
|
||||
@@ -339,12 +343,13 @@ static cell_t sm_CallStartForward(IPluginContext *pContext, const cell_t *params
|
||||
Handle_t hndl;
|
||||
HandleError err;
|
||||
IForward *pForward;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
ResetCall();
|
||||
|
||||
hndl = static_cast<Handle_t>(params[1]);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward))
|
||||
if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, &sec, (void **)&pForward))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid forward handle %x (error %d)", hndl, err);
|
||||
|
||||
@@ -202,8 +202,9 @@ static cell_t SMC_SetParseStart(IPluginContext *pContext, const cell_t *params)
|
||||
Handle_t hndl = (Handle_t)params[1];
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -219,8 +220,9 @@ static cell_t SMC_SetParseEnd(IPluginContext *pContext, const cell_t *params)
|
||||
Handle_t hndl = (Handle_t)params[1];
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -236,8 +238,9 @@ static cell_t SMC_SetReaders(IPluginContext *pContext, const cell_t *params)
|
||||
Handle_t hndl = (Handle_t)params[1];
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -255,8 +258,9 @@ static cell_t SMC_SetRawLine(IPluginContext *pContext, const cell_t *params)
|
||||
Handle_t hndl = (Handle_t)params[1];
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
@@ -272,8 +276,9 @@ static cell_t SMC_ParseFile(IPluginContext *pContext, const cell_t *params)
|
||||
Handle_t hndl = (Handle_t)params[1];
|
||||
HandleError err;
|
||||
ParseInfo *parse;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse))
|
||||
if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err);
|
||||
|
||||
Reference in New Issue
Block a user