summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authornijtmans <nijtmans>2011-01-25 08:49:59 (GMT)
committernijtmans <nijtmans>2011-01-25 08:49:59 (GMT)
commitdc7efa547588f50966a45427aabbf05023e368a7 (patch)
tree05ebd64c7a56b5c6c3ba5b75b9e88c284d137a77 /generic
parent5c2c4533ed5875fe2453327d0b5add7dda900c31 (diff)
downloadtk-dc7efa547588f50966a45427aabbf05023e368a7.zip
tk-dc7efa547588f50966a45427aabbf05023e368a7.tar.gz
tk-dc7efa547588f50966a45427aabbf05023e368a7.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')
-rw-r--r--generic/tkSelect.c6
-rw-r--r--generic/tkTextDisp.c4
2 files changed, 5 insertions, 5 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;
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 48897bd..e16bace 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.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: tkTextDisp.c,v 1.14.2.5 2007/04/29 02:24:02 das Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.14.2.6 2011/01/25 08:49:59 nijtmans Exp $
*/
#include "tkPort.h"
@@ -4586,7 +4586,7 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
(sizeof(CharInfo) - 3 + bytesThatFit));
chunkPtr->clientData = (ClientData) ciPtr;
ciPtr->numBytes = bytesThatFit;
- strncpy(ciPtr->chars, p, (size_t) bytesThatFit);
+ memcpy(ciPtr->chars, p, (size_t) bytesThatFit);
if (p[bytesThatFit - 1] == '\n') {
ciPtr->numBytes--;
}