summaryrefslogtreecommitdiffstats
path: root/generic/tclEnv.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-04-23 17:34:05 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-04-23 17:34:05 (GMT)
commit401efde7b4d67a1ca4b84373795ec67ccd785306 (patch)
tree2797649b1f689dcf56aa42cd39b149ed9ceb4476 /generic/tclEnv.c
parent076e6b32aa2f08565a146e877bd3197bc027b3a4 (diff)
downloadtcl-401efde7b4d67a1ca4b84373795ec67ccd785306.zip
tcl-401efde7b4d67a1ca4b84373795ec67ccd785306.tar.gz
tcl-401efde7b4d67a1ca4b84373795ec67ccd785306.tar.bz2
* generic/tclEnv.c (ReplaceString): Clear memory correctly when
growing the cache to avoid reads of uninitialised data. * generic/tclStrToD.c (AccumulateDecimalDigit): Fixed a mistake where we'd run beyond the end of the 'pow10_wide' array if a number begins with a string of more than 'maxpow10_wide' zeroes. Both these issues reported under [Bug 1705778] - detected with the existing test suite, no new regression tests required.
Diffstat (limited to 'generic/tclEnv.c')
-rw-r--r--generic/tclEnv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 596e68b..30bce65 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.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: tclEnv.c,v 1.32 2007/04/10 14:47:13 dkf Exp $
+ * RCS: @(#) $Id: tclEnv.c,v 1.33 2007/04/23 17:34:06 kennykb Exp $
*/
#include "tclInt.h"
@@ -677,7 +677,8 @@ ReplaceString(
environCache = (char **) ckrealloc ((char *) environCache,
(cacheSize + growth) * sizeof(char *));
environCache[cacheSize] = newStr;
- (void) memset(environCache+cacheSize+1, (int) 0, (size_t) (growth - 1));
+ (void) memset(environCache+cacheSize+1, (int) 0,
+ (size_t) ((growth-1) * sizeof(char*)));
cacheSize += growth;
}
}