summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-02-15 15:58:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-02-15 15:58:36 (GMT)
commit7a1cc7e3b33b8f9f64a8e50228c7e10187a67397 (patch)
treeaec3a9bdac672e7e85817ad81962c86dc3dbd83a /generic
parent0b90c0b92ef642157c6796ab26ebf3dade98b05a (diff)
downloadtcl-7a1cc7e3b33b8f9f64a8e50228c7e10187a67397.zip
tcl-7a1cc7e3b33b8f9f64a8e50228c7e10187a67397.tar.gz
tcl-7a1cc7e3b33b8f9f64a8e50228c7e10187a67397.tar.bz2
Guarantee the buffer is large enough it will not be overrun.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclDisassemble.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 48206b5..e9aaec4 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -818,7 +818,7 @@ UpdateStringOfInstName(
Tcl_Obj *objPtr)
{
size_t len, inst = (size_t)objPtr->internalRep.wideValue;
- char *s, buf[20];
+ char *s, buf[TCL_INTEGER_SPACE + 5];
if (inst > LAST_INST_OPCODE) {
sprintf(buf, "inst_%" TCL_Z_MODIFIER "d", inst);
@@ -827,6 +827,7 @@ UpdateStringOfInstName(
s = (char *) tclInstructionTable[inst].name;
}
len = strlen(s);
+ /* assert (len < UINT_MAX) */
objPtr->bytes = ckalloc(len + 1);
memcpy(objPtr->bytes, s, len + 1);
objPtr->length = len;