Otherwise we can get crashes on NULL dereference. This should only happen on reverse connections where we don't have a server address.tags/v1.12.90
@@ -52,7 +52,7 @@ CConnection::CConnection() | |||
supportsDesktopResize(false), supportsLEDState(false), | |||
is(0), os(0), reader_(0), writer_(0), | |||
shared(false), | |||
state_(RFBSTATE_UNINITIALISED), | |||
state_(RFBSTATE_UNINITIALISED), serverName(strDup("")), | |||
pendingPFChange(false), preferredEncoding(encodingTight), | |||
compressLevel(2), qualityLevel(-1), | |||
formatChange(false), encodingChange(false), | |||
@@ -68,6 +68,13 @@ CConnection::~CConnection() | |||
close(); | |||
} | |||
void CConnection::setServerName(const char* name_) | |||
{ | |||
if (name_ == NULL) | |||
name_ = ""; | |||
serverName.replaceBuf(strDup(name_)); | |||
} | |||
void CConnection::setStreams(rdr::InStream* is_, rdr::OutStream* os_) | |||
{ | |||
is = is_; |
@@ -48,7 +48,7 @@ namespace rfb { | |||
// which we are connected. This might be the result of getPeerEndpoint on | |||
// a TcpSocket, for example, or a host specified by DNS name & port. | |||
// The serverName is used when verifying the Identity of a host (see RA2). | |||
void setServerName(const char* name_) { serverName.replaceBuf(strDup(name_)); } | |||
void setServerName(const char* name_); | |||
// setStreams() sets the streams to be used for the connection. These must | |||
// be set before initialiseProtocol() and processMsg() are called. The |