From 14343fa7e19962d9e174cd77d5a3849eb5ef9e54 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Tue, 31 Jan 2017 13:22:39 +0000 Subject: [PATCH] #6344 Don't send clipboards over size limit to server --- src/lib/client/Client.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index 9e4b2f4d..661bd4ba 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -411,12 +411,17 @@ Client::sendClipboard(ClipboardID id) // check time if (m_timeClipboard[id] == 0 || clipboard.getTime() != m_timeClipboard[id]) { - // save new time - m_timeClipboard[id] = clipboard.getTime(); - // marshall the data - String data = clipboard.marshall(); + String data = clipboard.marshall(); + if (data.size() >= m_maximumClipboardSize * 1024) { + LOG((CLOG_NOTE "Skipping clipboard transfer because the clipboard" + " contents exceeds the %i MB size limit set by the server", + m_maximumClipboardSize / 1024)); + return; + } + // save new time + m_timeClipboard[id] = clipboard.getTime(); // save and send data if different or not yet sent if (!m_sentClipboard[id] || data != m_dataClipboard[id]) { m_sentClipboard[id] = true;