Validate ent index bounds in LookupEntity (bug 5080, r=fyren).
authorNicholas Hastings <skamonkey@gmail.com>
Fri Sep 09 15:29:17 2011 -0400 (2011-09-09)
changeset 33872e920b7fa23f
parent 3386 05279606359a
child 3388 cbee39527756
child 3389 68d3e56f4bb7
Validate ent index bounds in LookupEntity (bug 5080, r=fyren).
core/HalfLife2.cpp
     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 */