Validate ent index bounds in LookupEntity (bug 5080, r=fyren).
Validate ent index bounds in LookupEntity (
bug 5080, r=fyren).
1.1 --- a/core/HalfLife2.cpp Thu Sep 08 19:59:09 2011 -0400
1.2 +++ b/core/HalfLife2.cpp Fri Sep 09 15:29:17 2011 -0400
1.3 @@ -787,6 +787,12 @@
1.4 */
1.5 CEntInfo *CHalfLife2::LookupEntity(int entIndex)
1.6 {
1.7 + // Make sure that our index is within the bounds of the global ent array
1.8 + if (entIndex < 0 || entIndex >= NUM_ENT_ENTRIES)
1.9 + {
1.10 + return NULL;
1.11 + }
1.12 +
1.13 if (!g_EntList || entInfoOffset == -1)
1.14 {
1.15 /* Attempt to use engine interface instead */