From 2285db2b629e400a37e7a741ccf07ae8388ed1e9 Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Tue, 19 May 2026 13:08:47 +0200 Subject: [PATCH] Treat ExtendedClipboard messages with the Caps bit as Caps regardless of co-set action bits --- client/vnc/server/session_clipboard.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/vnc/server/session_clipboard.go b/client/vnc/server/session_clipboard.go index 3b3e13abe..c4554970f 100644 --- a/client/vnc/server/session_clipboard.go +++ b/client/vnc/server/session_clipboard.go @@ -139,11 +139,16 @@ func (s *session) handleExtCutText(payloadLen uint32) error { formats := flags & extClipFormatMask rest := buf[4:] - switch action { - case extClipActionCaps: + // A Caps message sets the Caps bit alongside one bit per action the + // peer supports, so the action byte is multi-bit. Detect it first; the + // remaining actions are single-bit and are dispatched after. + if action&extClipActionCaps != 0 { // Client max sizes are informational for us today: we only emit // text and already cap it at extClipMaxText. return nil + } + + switch action { case extClipActionRequest: if formats&extClipFormatText != 0 { return s.sendExtClipProvideText()