summaryrefslogtreecommitdiffstats
path: root/generic/tkSelect.c
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2003-01-14 19:23:55 (GMT)
committerjenglish <jenglish@flightlab.com>2003-01-14 19:23:55 (GMT)
commita7c7b0a8ef6483989d0a26c1ecff26082af9fed7 (patch)
tree5785c6425b51ccf9e86588eaabdb2c5c93cadbed /generic/tkSelect.c
parent5ae8904c94d71fcc6507eb85784490ddd6a348cd (diff)
downloadtk-a7c7b0a8ef6483989d0a26c1ecff26082af9fed7.zip
tk-a7c7b0a8ef6483989d0a26c1ecff26082af9fed7.tar.gz
tk-a7c7b0a8ef6483989d0a26c1ecff26082af9fed7.tar.bz2
* generic/tkSelect.c (Tk_CreateSelHandler):
Fix for #666346 "Selection handling crashes under KDE 3.0" * tests/unixSelect.test (unixSelect-1.20): Added test case.
Diffstat (limited to 'generic/tkSelect.c')
-rw-r--r--generic/tkSelect.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index af98ccd..d62aa43 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkSelect.c,v 1.12 2002/08/31 06:12:26 das Exp $
+ * RCS: @(#) $Id: tkSelect.c,v 1.13 2003/01/14 19:24:56 jenglish Exp $
*/
#include "tkInt.h"
@@ -200,9 +200,10 @@ Tk_CreateSelHandler(tkwin, selection, target, proc, clientData, format)
* The clientData is selection controlled memory, so
* we should make a copy for this selPtr.
*/
- selPtr->clientData =
- (ClientData) ckalloc(sizeof(clientData));
- memcpy(selPtr->clientData, clientData, sizeof(clientData));
+ unsigned cmdInfoLen = sizeof(CommandInfo) +
+ ((CommandInfo*)clientData)->cmdLength - 3;
+ selPtr->clientData = (ClientData)ckalloc(cmdInfoLen);
+ memcpy(selPtr->clientData, clientData, cmdInfoLen);
} else {
selPtr->clientData = clientData;
}