diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-10-01 12:52:48 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-10-01 12:52:48 (GMT) |
commit | 0ee4b2f57c83341c5896b9abe552e28874292a12 (patch) | |
tree | 9bc2b696d5f1dd703e2c0f71eec0ffb13ca67447 /macosx | |
parent | c240909716db63ba2036f34e975de5905b2871dd (diff) | |
download | tcl-0ee4b2f57c83341c5896b9abe552e28874292a12.zip tcl-0ee4b2f57c83341c5896b9abe552e28874292a12.tar.gz tcl-0ee4b2f57c83341c5896b9abe552e28874292a12.tar.bz2 |
* generic/tclBasic.c, generic/tclClock.c, generic/tclEncoding.c,
* generic/tclEnv.c, generic/tclLoad.c, generic/tclNamesp.c,
* generic/tclObj.c, generic/tclRegexp.c, generic/tclResolve.c,
* generic/tclResult.c, generic/tclUtil.c, macosx/tclMacOSXFCmd.c:
More purging of strcpy() from locations where we already know the
length of the data being copied.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tclMacOSXFCmd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index 818b91d..ebcc56c 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.19 2010/03/25 14:02:11 dkf Exp $ + * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.20 2010/10/01 12:52:50 dkf Exp $ */ #include "tclInt.h" @@ -688,6 +688,7 @@ UpdateStringOfOSType( OSType osType = (OSType) objPtr->internalRep.longValue; Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); + unsigned len; string[0] = (char) (osType >> 24); string[1] = (char) (osType >> 16); @@ -695,8 +696,9 @@ UpdateStringOfOSType( string[3] = (char) (osType); string[4] = '\0'; Tcl_ExternalToUtfDString(encoding, string, -1, &ds); - objPtr->bytes = ckalloc((unsigned) Tcl_DStringLength(&ds) + 1); - strcpy(objPtr->bytes, Tcl_DStringValue(&ds)); + len = (unsigned) Tcl_DStringLength(&ds) + 1; + objPtr->bytes = ckalloc(len); + memcpy(objPtr->bytes, Tcl_DStringValue(&ds), len); objPtr->length = Tcl_DStringLength(&ds); Tcl_DStringFree(&ds); Tcl_FreeEncoding(encoding); |