.
D 2000-11-01T14:51:16
J assignee nobody
J cmimetype text/plain
J comment 'string\sindex'\shas\sa\sbug.\s\sIf\syou\sgive\san\sindex\svalue\sthat's\slarger\sthan\nthe\slength\sof\sthe\sstring,\sor\sless\sthan\s0,\sit\sdoesn't\sdo\sbounds\schecking.\n\nIf\syou\slook\saround\sline\s1210\sof\stclCmdMZ.c\sin\stcl\s8.3.2,\syou'll\ssee\sa\nreference\sto\sstring[index]\sbut\sthere\swas\sno\scheck\sto\sverify\sthat\s'index'\nis\swithin\sthe\sstring\sarray\sbound.\s\n\nI\ssuggest\sthat\sthis:\n\sTcl_SetByteArrayObj(resultPtr,\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s(unsigned\schar\s*)(&string1[index]),\s1)\n\nbe\sreplaced\swith\sthis:\n\n\sif\s((index\s>=\s0)\s&&\s(index\s<\slength1))\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sTcl_SetByteArrayObj(resultPtr,\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s(unsigned\schar\s*)(&string1[index]),\s1);\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s}
J foundin
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem
J title 'string\sindex'\sdoesn't\sdo\sbounds\schecking
J type Bug
K 220996ffffffffffffffffffffffffffffffffff
U nobody
Z 92494766212e66bf1ec115d0ca9d21c0