summaryrefslogtreecommitdiffstats
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
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]
-rw-r--r--ChangeLog6
-rw-r--r--generic/tkSelect.c4
-rw-r--r--unix/tkUnixWm.c4
-rw-r--r--win/tkWinWm.c4
4 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index e3a51a9..f835f0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-25 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkSelect.c: [Patch #3129527]: Fix buffer overflow w/ GCC 4.5 and
+ * win/tkWinWm.c -D_FORTIFY_SOURCE=2. Just the strcpy->memcpy part,
+ * unix/tkUnixWm.c to prevent anything like [Bug #3164879]
+
2011-01-22 Joe English <jenglish@users.sourceforge.net>
* generic/ttk/ttkEntry.c(ttk::combobox): Add missing
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);
}
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index e12f3a6..73d62c2 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixWm.c,v 1.58.2.8 2010/02/16 21:15:11 nijtmans Exp $
+ * RCS: @(#) $Id: tkUnixWm.c,v 1.58.2.9 2011/01/25 08:31:37 nijtmans Exp $
*/
#include "tkUnixInt.h"
@@ -3020,7 +3020,7 @@ WmProtocolCmd(
protPtr->nextPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr;
protPtr->interp = interp;
- strcpy(protPtr->command, cmd);
+ memcpy(protPtr->command, cmd, cmdLength + 1);
}
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
UpdateWmProtocols(wmPtr);
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 5685ac0..67c2a6e 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinWm.c,v 1.124.2.9 2010/03/12 13:02:36 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.124.2.10 2011/01/25 08:31:37 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -5005,7 +5005,7 @@ WmProtocolCmd(
protPtr->nextPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr;
protPtr->interp = interp;
- strcpy(protPtr->command, cmd);
+ memcpy(protPtr->command, cmd, cmdLength + 1);
}
return TCL_OK;
}