'string index' doesn't do bounds checking
Closed / Fixed220996ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-11-01 14:51:16
'string index' has a bug. If you give an index value that's larger than
the length of the string, or less than 0, it doesn't do bounds checking.
If you look around line 1210 of tclCmdMZ.c in tcl 8.3.2, you'll see a
reference to string[index] but there was no check to verify that 'index'
is within the string array bound.
I suggest that this:
Tcl_SetByteArrayObj(resultPtr,
(unsigned char *)(&string1[index]), 1)
be replaced with this:
if ((index >= 0) && (index < length1)) {
Tcl_SetByteArrayObj(resultPtr,
(unsigned char *)(&string1[index]), 1);
}
ericmplain2000-11-02 03:50:33
This bug has already been fixed for 8.4a2. Eric Melski The Other Tcl Guy ericm at ajubasolutions.com Ajuba Solutions
ericm Closed ticket [220996ffff].
[History diff]2000-11-02 04:35:32
ericm Ticket [220996ffff]: 5 changes
[History diff]2000-11-02 04:40:25
dgp Ticket [220996ffff]: 3 changes
[History diff]2001-04-05 07:10:07
Log in (anonymous is fine) to add a comment.