Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11827 closed defect (fixed)

Tcl_AppendResult not NULL-terminated in fs-traverse.c

Reported by: sfiera@… Owned by: kballard (Kevin Ballard)
Priority: High Milestone: MacPorts 1.4
Component: base Version: 1.4
Keywords: fs-traverse Tcl_AppendResult Cc: kballard (Kevin Ballard), sfiera@…


I was just trying to traverse a list of directories using fs-traverse. I have since realized that fs-traverse will not handle a list of directories. However, rather than failing gracefully and reporting that the requested directory didn't exist, it was crashing with a bus error. I traced this problem back to the invocations of Tcl_AppendResult in fs-traverse.c, which are used to report errors.

According to its manpage, Tcl_AppendResult takes a NULL-terminated list of strings. The invocations in fs-traverse.c didn't do this. I've patched it; however, although fs-traverse doesn't have a "maintainer," I'll defer to Eridius on committing it since it's his creation.

Attachments (1)

fs-traverse.diff (885 bytes) - added by sfiera@… 11 years ago.

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by sfiera@…

Attachment: fs-traverse.diff added


comment:1 Changed 11 years ago by kballard (Kevin Ballard)

Resolution: fixed
Status: newclosed

Looks good. I've committed your patch in r24396. Sorry about that - I didn't have a problem in my own testing, I guess I was just lucky. And stupid for not even thinking about this issue, since I'm well acquainted with how varargs stuff works :/

As for a list of directories, you can use eval to work around that. Or I can "fix" fs-traverse to take a list of directories instead of the dynamic args it currently takes. I just created a new ticket, #11836, about this issue.

comment:2 Changed 11 years ago by kballard (Kevin Ballard)

Milestone: MacPorts 1.4.3MacPorts 1.5

comment:3 Changed 11 years ago by jmpp@…

Milestone: MacPorts 1.5MacPorts 1.4

comment:4 Changed 11 years ago by nox@…

Priority: ImportantHigh

comment:5 Changed 11 years ago by jmpp@…

Never merged into the release_1_4 branch as such, but as the switch to the fts(3) family of functions for fs-traverse.c in r24908.


Note: See TracTickets for help on using tickets.