diff options
author | Justin Berger <j.david.berger@gmail.com> | 2017-07-21 03:18:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-08-31 19:35:46 (GMT) |
commit | 124424e9974ade26521bf4751f3701c1e7d91c3d (patch) | |
tree | 7ba1f93ae1fe351cd5fd04fbeb9ca30e94c78dee | |
parent | 693fa0a96e111270337eb76a4da1255774657e1a (diff) | |
download | CMake-124424e9974ade26521bf4751f3701c1e7d91c3d.zip CMake-124424e9974ade26521bf4751f3701c1e7d91c3d.tar.gz CMake-124424e9974ade26521bf4751f3701c1e7d91c3d.tar.bz2 |
server: Protect several fields from potentially pointing to bad memory
-rw-r--r-- | Source/cmConnection.cxx | 5 | ||||
-rw-r--r-- | Source/cmServerConnection.cxx | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmConnection.cxx b/Source/cmConnection.cxx index 89013dc..c0d1b82 100644 --- a/Source/cmConnection.cxx +++ b/Source/cmConnection.cxx @@ -118,7 +118,9 @@ void cmEventBasedConnection::OnDisconnect(int onerror) { (void)onerror; this->OnConnectionShuttingDown(); - this->Server->OnDisconnect(this); + if (this->Server) { + this->Server->OnDisconnect(this); + } } cmConnection::~cmConnection() @@ -127,6 +129,7 @@ cmConnection::~cmConnection() bool cmConnection::OnConnectionShuttingDown() { + this->Server = nullptr; return true; } diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx index e686403..44af75f 100644 --- a/Source/cmServerConnection.cxx +++ b/Source/cmServerConnection.cxx @@ -53,6 +53,9 @@ void cmStdIoConnection::SetupStream(uv_stream_t*& stream, int file_id) void cmStdIoConnection::SetServer(cmServerBase* s) { cmConnection::SetServer(s); + if (!s) { + return; + } SetupStream(this->ReadStream, 0); SetupStream(this->WriteStream, 1); |