From dc7f91c2a16227f9195ab9273290294a25689194 Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 17 Oct 2012 12:19:20 +0000 Subject: Fixed a vulnerability in cClientHandle::HandleRespawn() Changed some hook locations: Moved HOOK_PLAYER_JOIN to where HOOK_PLAYER_SPAWN was (before player is added to the world) Added HOOK_PLAYER_SPAWN to after a player's initial spawn and after a player is re-spawned after death git-svn-id: http://mc-server.googlecode.com/svn/trunk@972 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ClientHandle.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index f526432b4..792fc3db4 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -230,7 +230,7 @@ void cClientHandle::Authenticate(void) m_Player->SetIP (m_IPString); - cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_PLAYER_SPAWN, 1, m_Player); + cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_PLAYER_JOIN, 1, m_Player); m_ConfirmPosition = m_Player->GetPosition(); @@ -258,6 +258,8 @@ void cClientHandle::Authenticate(void) // Broadcast this player's spawning to all other players in the same chunk m_Player->GetWorld()->BroadcastSpawn(*m_Player, this); + + cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_PLAYER_SPAWN, 1, m_Player); } @@ -920,7 +922,13 @@ void cClientHandle::HandleUseEntity(int a_TargetEntityID, bool a_IsLeftClick) void cClientHandle::HandleRespawn(void) { + if( m_Player == NULL ) + { + Destroy(); + return; + } m_Player->Respawn(); + cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_PLAYER_SPAWN, 1, m_Player); } -- cgit v1.2.3