Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b807bc6f0b4f4d7cebf083001e504d7f858311c9
Ticket: 220996ffffffffffffffffffffffffffffffffff
'string index' doesn't do bounds checking
User & Date: nobody on 2000-11-01 14:51:16
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    '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);
                    }
    
  4. foundin changed to: ""
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: ""
  10. title changed to: "'string index' doesn't do bounds checking"
  11. type changed to: "Bug"