Skip to content
Tcl Source Code View Ticket
Login

View Ticket

gets with limited line length

Open1399062fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2006-01-07 07:20:06
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
coldstoreplain2006-01-07 14:20:10
File Added - 162470: tclIO.diff
coldstoreplain2006-01-07 14:22:00
File Added - 162471: tclIOCmd.diff
coldstoreplain2006-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
dkf Ticket [1399062fff]: 2 changes [History diff]2006-01-09 16:02:30
nobodyplain2006-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 :-)
Log in (anonymous is fine) to add a comment.

Attachments: