From b89261358261522eb9696c87ad4d841878d17070 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 5 Jan 2021 10:24:18 +0100 Subject: [PATCH] Handle clipboard peek with missing data The peer expects a response, so we should also be able to respond that there is no clipboard data currently available. --- common/rfb/CConnection.cxx | 4 +--- common/rfb/SConnection.cxx | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 538d90a8..6632efa8 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -504,10 +504,8 @@ void CConnection::handleClipboardRequest(rdr::U32 flags) void CConnection::handleClipboardPeek(rdr::U32 flags) { - if (!hasLocalClipboard) - return; if (server.clipboardFlags() & rfb::clipboardNotify) - writer()->writeClipboardNotify(rfb::clipboardUTF8); + writer()->writeClipboardNotify(hasLocalClipboard ? rfb::clipboardUTF8 : 0); } void CConnection::handleClipboardNotify(rdr::U32 flags) diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index 1b5f513e..b4f63ae8 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -334,10 +334,8 @@ void SConnection::handleClipboardRequest(rdr::U32 flags) void SConnection::handleClipboardPeek(rdr::U32 flags) { - if (!hasLocalClipboard) - return; if (client.clipboardFlags() & rfb::clipboardNotify) - writer()->writeClipboardNotify(rfb::clipboardUTF8); + writer()->writeClipboardNotify(hasLocalClipboard ? rfb::clipboardUTF8 : 0); } void SConnection::handleClipboardNotify(rdr::U32 flags) -- 2.39.5