fixed bug amb1132 - team finding code crashed ins from null deref
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401679
This commit is contained in:
		
							parent
							
								
									0aa30ccde2
								
							
						
					
					
						commit
						116553f7df
					
				@ -84,16 +84,21 @@ void SDKTools::OnServerActivate(edict_t *pEdictList, int edictCount, int clientM
 | 
				
			|||||||
		ServerClass *pClass = pEdict->GetNetworkable()->GetServerClass();
 | 
							ServerClass *pClass = pEdict->GetNetworkable()->GetServerClass();
 | 
				
			||||||
		if (FindTeamEntities(pClass->m_pTable, "DT_Team"))
 | 
							if (FindTeamEntities(pClass->m_pTable, "DT_Team"))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			static int offset = g_pGameHelpers->FindInSendTable(pClass->GetName(), "m_iTeamNum")->GetOffset();
 | 
								SendProp *pTeamNumProp = g_pGameHelpers->FindInSendTable(pClass->GetName(), "m_iTeamNum");
 | 
				
			||||||
			CBaseEntity *pEnt = pEdict->GetUnknown()->GetBaseEntity();
 | 
					 | 
				
			||||||
			int TeamIndex = *(int *)((unsigned char *)pEnt + offset);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (TeamIndex >= (int)g_Teams.size())
 | 
								if (pTeamNumProp != NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				g_Teams.resize(TeamIndex+1);
 | 
									int offset = pTeamNumProp->GetOffset();
 | 
				
			||||||
 | 
									CBaseEntity *pEnt = pEdict->GetUnknown()->GetBaseEntity();
 | 
				
			||||||
 | 
									int TeamIndex = *(int *)((unsigned char *)pEnt + offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									if (TeamIndex >= (int)g_Teams.size())
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										g_Teams.resize(TeamIndex+1);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									g_Teams[TeamIndex].ClassName = pClass->GetName();
 | 
				
			||||||
 | 
									g_Teams[TeamIndex].pEnt = pEnt;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			g_Teams[TeamIndex].ClassName = pClass->GetName();
 | 
					 | 
				
			||||||
			g_Teams[TeamIndex].pEnt = pEnt;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user