Validate entity in GetEntPropEnt, GetEntDataEnt2 (r=me).

This commit is contained in:
Nicholas Hastings 2012-12-16 19:52:31 -05:00
parent c2300f7b2b
commit ab06cf4788

View File

@ -620,8 +620,13 @@ static cell_t GetEntDataEnt2(IPluginContext *pContext, const cell_t *params)
}
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
int index = hndl.GetEntryIndex();
int ref = g_HL2.IndexToReference(hndl.GetEntryIndex());
CEntInfo *pInfo = g_HL2.LookupEntity(index);
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
return -1;
int ref = g_HL2.IndexToReference(index);
return g_HL2.ReferenceToBCompatRef(ref);
}
@ -1493,8 +1498,13 @@ static cell_t GetEntPropEnt(IPluginContext *pContext, const cell_t *params)
}
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
int index = hndl.GetEntryIndex();
int ref = g_HL2.IndexToReference(hndl.GetEntryIndex());
CEntInfo *pInfo = g_HL2.LookupEntity(index);
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
return -1;
int ref = g_HL2.IndexToReference(index);
return g_HL2.ReferenceToBCompatRef(ref);
}