From 6eea4252805a989a3743d954a6a28c64932c408b Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Fri, 2 Aug 2024 21:36:49 +0800 Subject: [PATCH] fix: clipboard cm ipc data, raw bytes (#8930) * fix: clipboard cm ipc data, raw bytes Signed-off-by: fufesou * Remove useless check Signed-off-by: fufesou --------- Signed-off-by: fufesou --- src/server/clipboard_service.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) 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(); } } }