Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl_LogCommandInfo() fails with length == -1

Closed / Fixed1968245fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2008-05-20 20:36:38
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.
cdarrochplain2008-05-21 03:36:39
File Added - 278472: tclNamesp.c.patch
cdarrochplain2008-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.
dgp Ticket [1968245fff]: 2 changes [History diff]2008-05-21 20:42:08
dgpplain2008-05-22 22:14:10
Logged In: YES 
user_id=80530
Originator: NO


2005-09-14 commit to tclBasic.c
introduced this bug.
dgpplain2008-05-22 22:18:32
Logged In: YES 
user_id=80530
Originator: NO


Fixed on HEAD and for 8.5.3
Log in (anonymous is fine) to add a comment.

Attachments: