mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-06 04:03:27 +03:00
server: Protect several fields from potentially pointing to bad memory
This commit is contained in:
1 parent
693fa0a96e
commit
124424e997
2 files changed
+7
-1
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user