Clean up internal clipboard handling
We now filter incoming data, which means we can start assuming the
clipboard data is always null terminated. This allows us to clean
up a lot of the internal handling.
diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx
index fed0bd2..f1fa58d 100644
--- a/common/rfb/CMsgWriter.cxx
+++ b/common/rfb/CMsgWriter.cxx
@@ -179,11 +179,14 @@
}
-void CMsgWriter::writeClientCutText(const char* str, rdr::U32 len)
+void CMsgWriter::writeClientCutText(const char* str)
{
- if (memchr(str, '\r', len) != NULL)
+ size_t len;
+
+ if (strchr(str, '\r') != NULL)
throw Exception("Invalid carriage return in clipboard data");
+ len = strlen(str);
startMsg(msgTypeClientCutText);
os->pad(3);
os->writeU32(len);