zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: luomat+Lists/Zsh/workers@luomat.peak.org (Timothy J Luoma)
Cc: zsh-workers@math.gatech.edu
Subject: Re: ``mktemp() possibly used unsafely''
Date: Tue, 5 May 1998 00:06:26 -0500 (CDT)	[thread overview]
Message-ID: <199805050506.AAA01738@hzoli.home> (raw)
In-Reply-To: <199805050231.WAA27346@luomat.peak.org> from Timothy J Luoma at "May 4, 98 10:31:33 pm"

> utils.o: warning: mktemp() possibly used unsafely, consider using mkstemp ()
> 
> What is the danger here?  How do I change to mkstemp ?

Do not worry, mktemp is just fine if you know how to use it.  It is a
common mistake to use fopen or open with improper flags on the result of
mktemp.  A bad guy can guess the result of mktemp, and may try to create
a symlink with that name to some precious file, like your mailbox or
.rhosts file before your open is executed (but after mktemp has
finished).  Zsh always uses open(name, O_WRONLY | O_CREAT | O_EXCL, 0600)
to open such a file since 2.6-beta14.  Besides zsh also uses mktemp to
create temporary fifos for process substitution in which case mkstemp is
not really appropriate.

Ironically there has been a bug in the GNU libc and derivatives
(i.e. Linux libc 5) which created mkstemp files with 0666 permissions,
which means that mktemp when used properly can be more secure than
mkstemp.

Zoli


      parent reply	other threads:[~1998-05-05  5:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-05  2:31 Timothy J Luoma
1998-05-05  2:59 ` Geoff Wing
1998-05-05  5:06 ` Zoltan Hidvegi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199805050506.AAA01738@hzoli.home \
    --to=hzoli@cs.elte.hu \
    --cc=luomat+Lists/Zsh/workers@luomat.peak.org \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).