Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#11827 closed defect (fixed)

Tcl_AppendResult not NULL-terminated in fs-traverse.c

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

Description

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@… 17 years ago.
fs-traverse.c.diff

Download all attachments as: .zip

Change History (6)

Changed 17 years ago by sfiera@…

Attachment: fs-traverse.diff added

fs-traverse.c.diff

comment:1 Changed 17 years ago by kballard (Lily 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 17 years ago by kballard (Lily Ballard)

Milestone: MacPorts 1.4.3MacPorts 1.5

comment:3 Changed 17 years ago by jmpp@…

Milestone: MacPorts 1.5MacPorts 1.4

comment:4 Changed 17 years ago by nox@…

Cc: eridius@macports.org,sfiera@macports.orgeridius@macports.org, sfiera@macports.org
Priority: ImportantHigh

comment:5 Changed 17 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.

-jmpp

Note: See TracTickets for help on using tickets.