Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: clipboard cm ipc data, raw bytes (#8930)

fufesou6eea4252805a
diff --git a/src/server/clipboard_service.rs b/src/server/clipboard_service.rs
index d07fc74b4..3040a8f88 100644
--- a/src/server/clipboard_service.rs
+++ b/src/server/clipboard_service.rs
@@ -150,14 +150,8 @@ impl Handler {
Ok(Ok(mut data)) => {
for c in &mut contents {
if c.next_raw {
- if c.content_len <= data.len() {
- c.content =
- data.split_off(c.content_len).into();
- } else {
- // Reconnect the next time to avoid the next raw data mismatch.
- self.stream = None;
- bail!("failed to get raw clipboard data: invalid size");
- }
+ // No need to check the length because sum(content_len) == data.len().
+ c.content = data.split_to(c.content_len).into();
}
}
}