Hi,
While not heavely used, tac is a nice utility useful to reverse a file.
Unfortunately it uses creat() in order to create a temp file under /tmp
It needs to do this only if you use tac in pipe or with standard input
(otherwise it just jumps to the bottom of the file).
Here is the strace output:
stat("/tmp/taca03411", 0xbffff830) = -1 ENOENT (No such file or directory)
creat("/tmp/taca03411", 0600) = 3
The temp filename is something like taca0+pid so it is trivial to predict,
however, since tac uses stat() (not lstat) before creat() you can exploit this
only in order to creat new files (for example /etc/nologin).
I tested this for tac version 1.22 distribuited with
the "GNU Text Utilities".
regards,
antirez
--
Salvatore Sanfilippo, Open Source Developer, Linuxcare Italia spa
+39.049.8024648 tel, +39.049.8036484 fax
[EMAIL PROTECTED], http://www.linuxcare.com/
Linuxcare. Support for the revolution.