Skip to content

Commit

Permalink
Fix crash in SendPacket(), packet.SendPacket() and DisconnectClient()…
Browse files Browse the repository at this point in the history
… when the client was not yet logged in.

Those functions expected chrptr to be null when a character wasn't assigned to a client, but they instead got an uninitialized pointer. This caused a memory access error that crashed POL. Initializing those pointers to null fixes the issue.
  • Loading branch information
frozenblit committed Feb 27, 2021
1 parent 90b92f4 commit 0f230f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/docs.polserver.com/pol100/corechanges.xml
Expand Up @@ -5,11 +5,16 @@
<datemodified>02-27-2021</datemodified>
</header>
<version name="POL100">
<entry>
<date>02-27-2021</date>
<author>Nando:</author>
<change type="Fix">Crash in SendPacket(), packet.SendPacket() and DisconnectClient() when the client was not yet logged in. Mostly affects packet hooks.</change>
</entry>
<entry>
<date>02-27-2020</date>
<author>Turley, Kevin:</author>
<change type="Added">os::GetEnvironmentVariable(name:=&quot;&quot;)<br/>
Returns String value of given environment variable name. If name is empty, returns Dictionary of all allowed environment variables.<br/>
Returns String value of given environment variable name. If name is empty, returns Dictionary of all environment variables.<br/>
The pol.cfg setting AllowedEnvironmentVariablesAccess controls script access to this function. See documentation for more details.</change>
</entry>
<entry>
Expand Down
2 changes: 2 additions & 0 deletions pol-core/doc/core-changes.txt
@@ -1,4 +1,6 @@
-- POL100 --
02-27-2021 Nando:
Fix: Crash in SendPacket(), packet.SendPacket() and DisconnectClient() when the client was not yet logged in. Mostly affects packet hooks.
02-27-2020 Turley, Kevin:
Added: os::GetEnvironmentVariable(name:="")
Returns String value of given environment variable name. If name is empty, returns Dictionary of all environment variables.
Expand Down
3 changes: 3 additions & 0 deletions pol-core/pol/uoexec.cpp
Expand Up @@ -213,6 +213,9 @@ using namespace Module;
bool UOExecutor::getCharacterOrClientParam( unsigned param, Mobile::Character*& chrptr,
Network::Client*& clientptr )
{
chrptr = nullptr;
clientptr = nullptr;

BObjectImp* imp = getParamImp( param );
if ( imp == nullptr )
{
Expand Down

0 comments on commit 0f230f8

Please sign in to comment.