New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #11827 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Tcl_AppendResult not NULL-terminated in fs-traverse.c

Reported by: sfiera@… Owned by: eridius@…
Priority: High Milestone: MacPorts 1.4
Component: base Version: 1.4
Keywords: fs-traverse Tcl_AppendResult Cc: eridius@…, 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

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

Change History

Changed 8 years ago by sfiera@…

fs-traverse.c.diff

comment:1 Changed 8 years ago by eridius@…

  • Status changed from new to closed
  • Resolution set to fixed

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 8 years ago by eridius@…

  • Milestone changed from MacPorts 1.4.3 to MacPorts 1.5

comment:3 Changed 8 years ago by jmpp@…

  • Milestone changed from MacPorts 1.5 to MacPorts 1.4

comment:4 Changed 8 years ago by nox@…

  • Priority changed from Important to High
  • Cc changed from eridius@macports.org,sfiera@macports.org to eridius@macports.org, sfiera@macports.org

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