You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Bojan Smojver <bo...@rexursive.com> on 2003/10/03 04:50:13 UTC

tempnam v. mkstemp

Just noticed that libapreq uses it's own routine for temporary file,
apreq_file_mktemp (file src/apreq.c in APREQ 2). This function call tempnam,
which is apparently dangerous.

Maybe you can simply use apr_file_mktemp() instead for this?

-- 
Bojan

Re: tempnam v. mkstemp

Posted by Bojan Smojver <bo...@rexursive.com>.
No worries then.

On Fri, 2003-10-03 at 18:36, Joe Schaefer wrote:
> Bojan Smojver <bo...@rexursive.com> writes:
> 
> > Just noticed that libapreq uses it's own routine for temporary file,
> > apreq_file_mktemp (file src/apreq.c in APREQ 2). This function call
> > tempnam, which is apparently dangerous.
> 
> Nope, since apr doesn't provide any functional replacement for it.
> Note that we only use tempnam() for locating the operating system's
> temporary directory in case the user doesn't provide libapreq with 
> a preferred location.  This is the raison d'etre for apreq_file_mktemp,
> and is a very safe usage for tempnam, despite what your compiler tells
> you :-). 
-- 
Bojan


Re: tempnam v. mkstemp

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Bojan Smojver <bo...@rexursive.com> writes:

> Just noticed that libapreq uses it's own routine for temporary file,
> apreq_file_mktemp (file src/apreq.c in APREQ 2). This function call
> tempnam, which is apparently dangerous.

Nope, since apr doesn't provide any functional replacement for it.
Note that we only use tempnam() for locating the operating system's
temporary directory in case the user doesn't provide libapreq with 
a preferred location.  This is the raison d'etre for apreq_file_mktemp,
and is a very safe usage for tempnam, despite what your compiler tells
you :-). 

-- 
Joe Schaefer