Tcl Source Code

View Ticket
Login
Ticket UUID: 1399062
Title: gets with limited line length
Type: RFE Version: None
Submitter: coldstore Created on: 2006-01-07 07:20:06
Subsystem: 24. Channel Commands Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Open Last Modified: 2006-01-13 22:09:22
Resolution: None Closed By:
    Closed on:
Description:
gets can be fed an arbitrarily long line.

This can cause a segv.

Here are some patches relative to tcl in September to
fix it.

If there's any interest or intent to package, I'll have
a look at it under the latest tcl8.5
User Comments: nobody added on 2006-01-13 22:09:22:
Logged In: NO 

Are you sure it SEGV'd? Or was it a panic due to
not being able to malloc/realloc enough memory?

Also from an interface point of view it might be
better to put the limit on the filehandle and
not the call to gets. ie. make it fconfigure'able,
with Tcl providing a default of something suitably
big.

Not sure what the best course for it to do if it
hit the limit. Either (a) return a partial line,
or (b) throw an error. I think (b) is preferable
as (a) allows silent bugs to creep in and a
catch-able exception is preferable to a panic!

Although, how often do you see multi million long
character lines :-)

coldstore added on 2006-01-07 14:23:45:
Logged In: YES 
user_id=19214

Here is the release haiku for this RFI:

petals falling into pond,
gets with maxchar arg,
the carp sleeps all winter day

coldstore added on 2006-01-07 14:22:00:

File Added - 162471: tclIOCmd.diff

coldstore added on 2006-01-07 14:20:10:

File Added - 162470: tclIO.diff

Attachments: