Tcl Source Code

View Ticket
Login
Ticket UUID: 1968245
Title: Tcl_LogCommandInfo() fails with length == -1
Type: Bug Version: obsolete: 8.5.2
Submitter: cdarroch Created on: 2008-05-20 20:36:38
Subsystem: 45. Parsing and Eval Assigned To: dgp
Priority: 7 High Severity:
Status: Closed Last Modified: 2008-05-22 22:18:32
Resolution: Fixed Closed By: dgp
    Closed on: 2008-05-22 15:18:32
Description:
With Tcl 8.5.2, Tcl_LogCommandInfo() uses its length
argument in the following test before checking whether
length is negative, which a caller may use to indicate
that all bytes of the command argument (up to the first
null byte) should be used.  At least, the documentation
and code comments imply this is how the function
should operate, and it used to accept -1 as a length
value in 8.4.

Attached is a simple patch which checks for this and
uses strlen() to determine the length of the command
string.
User Comments: dgp added on 2008-05-22 22:18:32:
Logged In: YES 
user_id=80530
Originator: NO


Fixed on HEAD and for 8.5.3

dgp added on 2008-05-22 22:14:10:
Logged In: YES 
user_id=80530
Originator: NO


2005-09-14 commit to tclBasic.c
introduced this bug.

cdarroch added on 2008-05-21 03:39:43:
Logged In: YES 
user_id=637999
Originator: YES

Sorry, that wasn't particularly clear.  The test in question is:

overflow = (length > limit);

I believe length needs to be non-negative before this test
is performed.

cdarroch added on 2008-05-21 03:36:39:

File Added - 278472: tclNamesp.c.patch

Attachments: