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)
commit51e4c1bfc59696335911a15e7aa092b274a1ae8d (patch)
tree5102c8db204c464ad05ae31f1603514f24068789 /generic/tkSelect.c
parentaa38a961db4f58ac31d4f4b1e8e3d92c7f4b8738 (diff)
downloadtk-51e4c1bfc59696335911a15e7aa092b274a1ae8d.zip
tk-51e4c1bfc59696335911a15e7aa092b274a1ae8d.tar.gz
tk-51e4c1bfc59696335911a15e7aa092b274a1ae8d.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);
}