summaryrefslogtreecommitdiffstats
path: root/generic/tkSelect.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2011-01-25 08:49:59 (GMT)
committernijtmans <nijtmans>2011-01-25 08:49:59 (GMT)
commitd9f56d2b769b4cfce39f195178c30a407de8cccb (patch)
tree05ebd64c7a56b5c6c3ba5b75b9e88c284d137a77 /generic/tkSelect.c
parent31f8fbbd1d658b3474895271c7c3525112097d7e (diff)
downloadtk-d9f56d2b769b4cfce39f195178c30a407de8cccb.zip
tk-d9f56d2b769b4cfce39f195178c30a407de8cccb.tar.gz
tk-d9f56d2b769b4cfce39f195178c30a407de8cccb.tar.bz2
[Patch #3129527]: Fix buffer overflow w/ GCC 4.5 and -D_FORTIFY_SOURCE=2.
Just the strcpy->memcpy part, to prevent anything like [Bug #3164879]
Diffstat (limited to 'generic/tkSelect.c')
-rw-r--r--generic/tkSelect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 73e41d8..dccb49f 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.13.2.1 2005/11/22 11:32:37 dkf Exp $
+ * RCS: @(#) $Id: tkSelect.c,v 1.13.2.2 2011/01/25 08:49:59 nijtmans Exp $
*/
#include "tkInt.h"
@@ -917,7 +917,7 @@ Tk_SelectionObjCmd(clientData, interp, objc, objv)
cmdInfoPtr->byteOffset = 0;
cmdInfoPtr->buffer[0] = '\0';
cmdInfoPtr->cmdLength = cmdLength;
- strcpy(cmdInfoPtr->command, string);
+ memcpy(cmdInfoPtr->command, string, cmdLength + 1);
Tk_CreateSelHandler(tkwin, selection, target, HandleTclCommand,
(ClientData) cmdInfoPtr, format);
}
@@ -1016,7 +1016,7 @@ Tk_SelectionObjCmd(clientData, interp, objc, objv)
lostPtr = (LostCommand *) ckalloc((unsigned) (sizeof(LostCommand)
-3 + cmdLength));
lostPtr->interp = interp;
- strcpy(lostPtr->command, script);
+ memcpy(lostPtr->command, script, cmdLength + 1);
Tk_OwnSelection(tkwin, selection, LostSelection,
(ClientData) lostPtr);
return TCL_OK;