Added a sanity check on handle index in EntityToBCompatRef (bug 5539, r=psychonic).
authorKyle Sanderson <kyle.leet@gmail.com>
Sat Dec 01 13:41:00 2012 -0500 (2012-12-01)
changeset 369574cd59113b43
parent 3694 65d8f56a0006
child 3696 9588d737efe0
Added a sanity check on handle index in EntityToBCompatRef (bug 5539, r=psychonic).
core/HalfLife2.cpp
     1.1 --- a/core/HalfLife2.cpp	Sat Dec 01 13:39:34 2012 -0500
     1.2 +++ b/core/HalfLife2.cpp	Sat Dec 01 13:41:00 2012 -0500
     1.3 @@ -975,6 +975,11 @@
     1.4  	IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
     1.5  	CBaseHandle hndl = pUnknown->GetRefEHandle();
     1.6  
     1.7 +	if (hndl == INVALID_EHANDLE_INDEX)
     1.8 +	{
     1.9 +		return INVALID_EHANDLE_INDEX;
    1.10 +	}
    1.11 +	
    1.12  	if (hndl.GetEntryIndex() >= MAX_EDICTS)
    1.13  	{
    1.14  		return (hndl.ToInt() | (1<<31));