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/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx
index f0748ff..3d5a64c 100644
--- a/common/rfb/SMsgWriter.cxx
+++ b/common/rfb/SMsgWriter.cxx
@@ -78,11 +78,14 @@
endMsg();
}
-void SMsgWriter::writeServerCutText(const char* str, int len)
+void SMsgWriter::writeServerCutText(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(msgTypeServerCutText);
os->pad(3);
os->writeU32(len);