mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-26 13:16:18 +03:00
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:
parent
fd72bf17ce
commit
8b975878c2
@ -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:
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2389,3 +2389,9 @@ Server::dragInfoReceived(UInt32 fileNum, String content)
|
||||
|
||||
m_screen->startDraggingFiles(m_dragFileList);
|
||||
}
|
||||
|
||||
bool
|
||||
Server::isSecure() const
|
||||
{
|
||||
return m_clientListener->isSecure();
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user