[FFmpeg-devel] [PATCH] wrap mkstemp with umask
Erik Hovland
erik
Sun Jul 20 22:52:07 CEST 2008
On Thu, Jul 17, 2008 at 09:39:33PM +0200, Reimar D?ffinger wrote:
> Hello,
> On Thu, Jul 17, 2008 at 12:28:45PM -0700, Erik Hovland wrote:
> > It is possible that the current umask of the process creating the file
> > with mkstemp is such that the temp file could be writable by others then
> > the user. When mkstemp is used it can be wrapped with umask() calls to
> > make absolutely sure that the temp file cannot be tampered with.
>
> That makes it completely thread-unsafe.
Is the only caller using threads? It is likely that the code is not
thread-safe to begin with because it has two calls to mkstemp where it
changes the template. Whoever uses this call now should really hold a
lock (even w/out the umask calls).
But I am all for removing the code altogether. It seems that
libav{codec,format} is not really in the business of managing files.
E
--
Erik Hovland
mail: erik at hovland.org
web: http://hovland.org/
PGP/GPG public key available on request
More information about the ffmpeg-devel
mailing list