Make sure clipboard uses \n line endings
This is required by the protocol so we should make sure it is
enforced. We are tolerant of clients that violate this though and
convert incoming clipboard data.
diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx
index 200350c..0c0e8b2 100644
--- a/common/rfb/SMsgReader.cxx
+++ b/common/rfb/SMsgReader.cxx
@@ -212,10 +212,10 @@
vlog.error("Cut text too long (%d bytes) - ignoring", len);
return;
}
- CharArray ca(len+1);
- ca.buf[len] = 0;
+ CharArray ca(len);
is->readBytes(ca.buf, len);
- handler->clientCutText(ca.buf, len);
+ CharArray filtered(convertLF(ca.buf, len));
+ handler->clientCutText(filtered.buf, strlen(filtered.buf));
}
void SMsgReader::readQEMUMessage()