summaryrefslogtreecommitdiffstats
path: root/vncviewer/CConn.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2011-05-26 15:39:41 +0000
committerPierre Ossman <ossman@cendio.se>2011-05-26 15:39:41 +0000
commit689c45814dc9f954f8d8d36444203231d0803739 (patch)
tree185c513ed66f7df4ba65d6c647289a676d939c64 /vncviewer/CConn.cxx
parent63ca58e007e6f93f9f7e67d3a25716f6f1483d7f (diff)
downloadtigervnc-689c45814dc9f954f8d8d36444203231d0803739.tar.gz
tigervnc-689c45814dc9f954f8d8d36444203231d0803739.zip
Make sure we can handle clipboard data of any size.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4454 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/CConn.cxx')
-rw-r--r--vncviewer/CConn.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 28c8abbc..bc7b9489 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -339,18 +339,25 @@ void CConn::bell()
void CConn::serverCutText(const char* str, rdr::U32 len)
{
- char buffer[1024];
- int ret;
+ char *buffer;
+ int size, ret;
- ret = fl_utf8froma(buffer, sizeof(buffer), str, len);
- if (ret >= sizeof(buffer)) {
- vlog.error(_("Clipboard buffer overflow!"));
+ size = fl_utf8froma(NULL, 0, str, len);
+ if (size <= 0)
return;
- }
+
+ size++;
+
+ buffer = new char[size];
+
+ ret = fl_utf8froma(buffer, size, str, len);
+ assert(ret < size);
vlog.debug("Got clipboard data: '%s'", buffer);
Fl::copy(buffer, ret, 1);
+
+ delete [] buffer;
}
// We start timing on beginRect and stop timing on endRect, to