aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/CMsgWriter.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2019-05-02 12:32:03 +0200
committerPierre Ossman <ossman@cendio.se>2019-07-01 10:38:35 +0200
commit546b2ad80a68e80a737aade06f0685cccb5e9716 (patch)
tree60c577e30c103c16175047ea11c2bcee2b101258 /common/rfb/CMsgWriter.cxx
parent2ff61a285efda80cca7f1855aca23b99149bac8c (diff)
downloadtigervnc-546b2ad80a68e80a737aade06f0685cccb5e9716.tar.gz
tigervnc-546b2ad80a68e80a737aade06f0685cccb5e9716.zip
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.
Diffstat (limited to 'common/rfb/CMsgWriter.cxx')
-rw-r--r--common/rfb/CMsgWriter.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx
index d357c976..fed0bd27 100644
--- a/common/rfb/CMsgWriter.cxx
+++ b/common/rfb/CMsgWriter.cxx
@@ -181,6 +181,9 @@ void CMsgWriter::writePointerEvent(const Point& pos, int buttonMask)
void CMsgWriter::writeClientCutText(const char* str, rdr::U32 len)
{
+ if (memchr(str, '\r', len) != NULL)
+ throw Exception("Invalid carriage return in clipboard data");
+
startMsg(msgTypeClientCutText);
os->pad(3);
os->writeU32(len);