Skip to content

Commit

Permalink
Fix maximum clipboard size for protocol 1.8
Browse files Browse the repository at this point in the history
After revising the header files and definitions, conditions required
readjusting to support clipboard sizes over 65000 up to 320000
  • Loading branch information
alimirjamali committed Oct 23, 2024
1 parent 51acf98 commit 79d4434
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions gui-agent/vmside.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,18 +985,15 @@ static void send_clipboard_data(libvchan_t *vchan, XID window, char *data, uint3
struct msg_hdr hdr;
hdr.type = MSG_CLIPBOARD_DATA;
hdr.window = window;
if (len > MAX_CLIPBOARD_SIZE)
{
if (protocol_version >= QUBES_GUID_MIN_CLIPBOARD_4X) {
// xside is capable of receiving (up to) 4X of the previous size.
// it is also smarter. send one byte over the new buffer limit.
// A simple sign for xside to reject it.
len = MAX_CLIPBOARD_BUFFER_SIZE + 1;
} else {
// The dumb case. Truncate the data to the old size. User will lose
// some inter-vm clipboard data without being notified.
len = MAX_CLIPBOARD_SIZE;
}
if ((protocol_version < QUBES_GUID_MIN_CLIPBOARD_4X) && (len > MAX_CLIPBOARD_SIZE)) {
// The dumb case. Truncate the data to the old size. User might lose
// some inter-vm clipboard data without being notified.
len = MAX_CLIPBOARD_SIZE;
} else if (len > MAX_CLIPBOARD_BUFFER_SIZE + 1) {
// xside is capable of receiving (up to) 4X of the previous size.
// it is also smarter. send one byte over the new buffer limit.
// A simple sign for xside to reject it.
len = MAX_CLIPBOARD_BUFFER_SIZE + 1;
}
hdr.untrusted_len = len;
write_struct(vchan, hdr);
Expand Down

0 comments on commit 79d4434

Please sign in to comment.