Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6df6e1a278c4555356d2c6754b0b1b30af760343
Ticket: 2333466fffffffffffffffffffffffffffffffff
Tcl_IsChannelExisting() broken
User & Date: gneumann on 2008-11-23 15:56:31
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Tcl_IsChannelExisting() broken in versions at least from 8.4.14 until 8.5.5 + head version.
    
    If there exists e.g. a channel named "file76", a test for channel "sock7" will report, 
    that "sock7" exists already. Similarly, when there exists a channel named "sock182", 
    a test for "sock18" will be incorrect.
    
    The bug is pretty obvious in Tcl_IsChannelExisting() in tcl/generic/tclIO.c
    
    if ((*chanName == *name) &&
    (memcmp(name, chanName, (size_t) chanNameLen) == 0)) {
        return 1;
    }
    
    This comparison just tests, whether there exists a channel having the same first characters 
    as the queried channel,  but not, if the name existing channel and the queried channel have the
    same length. 
    
    There are many possible fixes; the fastest fix is most likely to increase chanNameLen
    by 1, or to compare the string lengths to make the test more explicit.
    
  4. foundin changed to: "obsolete: 8.5.5"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "gneumann"
  10. subsystem changed to: "25. Channel System"
  11. title changed to: "Tcl_IsChannelExisting() broken"
  12. type changed to: "Bug"