This one time, at band camp, Julien Valroff said:
> What can I do to prevent this?  Dmitry suggested using mktemp, but
> this would only *reduce* the probability of exploiting this race
> condition.

No, it pretty much eliminates it.  mktemp is clever enough to give you a
unique filename that doesn't currently exist and create the file before
returning.  Once mktemp has made the file, assuming correct permissions
on /tmp, an attacker can't replace it with a symlink, so this is as safe
as tempfile usage gets.
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        [EMAIL PROTECTED] |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

Reply via email to