The malloc function in the libSystem library in Apple Mac OS X 10.3.9 and 10.4.2 allows local users to overwrite arbitrary files by setting the MallocLogFile environment variable to the target file before running a setuid application.
http://www.suresec.org/advisories/adv7.pdf
http://www.ciac.org/ciac/bulletins/p-312.shtml
http://www.auscert.org.au/5509
http://secunia.com/advisories/16920/
http://lists.apple.com/archives/security-announce/2005/Sep/msg00002.html