Tcl Source Code

View Ticket
Login
Ticket UUID: 888777
Title: Potential mem leak in TcpGetOptionProc if host name too long
Type: Bug Version: obsolete: 8.4.5
Submitter: stwo Created on: 2004-02-01 23:41:26
Subsystem: 25. Channel System Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-02-25 21:58:53
Resolution: Fixed Closed By: dkf
    Closed on: 2004-02-25 14:58:53
Description:
In unix/tclUnixChan.c, TcpGetOptionProc,
options -peername and -sockname.
if the size of the hostname returned by the system
causes Tcl to allocate memory for Tcl_DString 'ds',
that memory will never be freed.

I have tested this with:
while {1} {fconfigure $sock -peername}
hostname <= 195 chars - ok
hostname > 195 chars - memory leak 

Patch included for Tcl-8.4.5

Stu
User Comments: stwo added on 2004-02-02 06:41:26:

File Added - 75432: patch-unix_tclUnixChan_c-DStringFree

Attachments: