Limited clipboard size to 1kb when SSL is enabled #4601

@XinyuHou I had no choice but to block clipboard data over 1kb in
size... anything over that and you get an access violation.
This commit is contained in:
Nick Bolton 2015-05-26 15:04:04 +01:00
parent fd72bf17ce
commit 8b975878c2
4 changed files with 27 additions and 2 deletions

View File

@ -64,6 +64,9 @@ public:
//! Get server which owns this listener
Server* getServer() { return m_server; }
//! Return true if using secure network connection
bool isSecure() { return m_useSecureNetwork; }
//@}
private:

View File

@ -29,6 +29,11 @@
// ClientProxy1_6
//
enum
{
kSslClipboardMaxSize = 1024
};
ClientProxy1_6::ClientProxy1_6(const String& name, synergy::IStream* stream, Server* server, IEventQueue* events) :
ClientProxy1_5(name, stream, server, events),
m_events(events)
@ -57,9 +62,17 @@ ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard* clipboard)
size_t size = data.size();
LOG((CLOG_DEBUG "sending clipboard %d to \"%s\"", id, getName().c_str()));
StreamChunker::sendClipboard(data, size, id, 0, m_events, this);
// HACK: if using SSL, don't send large clipboards (#4601)
bool send = true;
if (getServer()->isSecure() && (size > kSslClipboardMaxSize)) {
send = false;
LOG((CLOG_WARN "large clipboards not supported with ssl, size=%d", size));
}
LOG((CLOG_DEBUG "sent clipboard size=%d", size));
if (send) {
StreamChunker::sendClipboard(data, size, id, 0, m_events, this);
LOG((CLOG_DEBUG "sent clipboard size=%d", size));
}
}
}

View File

@ -2389,3 +2389,9 @@ Server::dragInfoReceived(UInt32 fileNum, String content)
m_screen->startDraggingFiles(m_dragFileList);
}
bool
Server::isSecure() const
{
return m_clientListener->isSecure();
}

View File

@ -175,6 +175,9 @@ public:
//! Return received file data
String& getReceivedFileData() { return m_receivedFileData; }
//! Return true if using secure network connection
bool isSecure() const;
//@}
private: