mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-05 21:02:39 +08:00
#6344 Don't send clipboards over size limit
This commit is contained in:
committed by
Nick Bolton
parent
14343fa7e1
commit
c3a4fe7f2b
@@ -525,6 +525,10 @@ Server::switchScreen(BaseClientProxy* dst,
|
||||
if (m_enableClipboard) {
|
||||
// send the clipboard data to new active screen
|
||||
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
|
||||
// Hackity hackity hack
|
||||
if (m_clipboards[id].m_clipboard.marshall().size() > (m_maximumClipboardSize * 1024)) {
|
||||
continue;
|
||||
}
|
||||
m_active->setClipboard(id, &m_clipboards[id].m_clipboard);
|
||||
}
|
||||
}
|
||||
@@ -1560,6 +1564,12 @@ Server::onClipboardChanged(BaseClientProxy* sender,
|
||||
|
||||
// ignore if data hasn't changed
|
||||
String data = clipboard.m_clipboard.marshall();
|
||||
if (data.size() > m_maximumClipboardSize * 1024) {
|
||||
LOG((CLOG_NOTE "not updating clipboard because it's over the size limit (%i KB) configured by the server",
|
||||
m_maximumClipboardSize));
|
||||
return;
|
||||
}
|
||||
|
||||
if (data == clipboard.m_clipboardData) {
|
||||
LOG((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user