summaryrefslogtreecommitdiffstats
path: root/generic/tkSelect.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2011-01-25 08:31:37 (GMT)
committernijtmans <nijtmans>2011-01-25 08:31:37 (GMT)
commite879651f606df661d88f8b3ae73bdbbd37d4082c (patch)
tree5102c8db204c464ad05ae31f1603514f24068789 /generic/tkSelect.c
parenta997d84bbfd5ab7b01bebf18efbc60b358770bc0 (diff)
downloadtk-e879651f606df661d88f8b3ae73bdbbd37d4082c.zip
tk-e879651f606df661d88f8b3ae73bdbbd37d4082c.tar.gz
tk-e879651f606df661d88f8b3ae73bdbbd37d4082c.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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index dca3d1c..b1551f0 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -10,7 +10,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.20 2007/04/17 14:36:49 dkf Exp $
+ * RCS: @(#) $Id: tkSelect.c,v 1.20.4.1 2011/01/25 08:31:37 nijtmans Exp $
*/
#include "tkInt.h"
@@ -909,7 +909,7 @@ Tk_SelectionObjCmd(
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);
}