]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Harden create_temp_filename() (version 2)
authorDavid Sommerseth <dazo@users.sourceforge.net>
Fri, 16 Apr 2010 20:02:36 +0000 (22:02 +0200)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Tue, 27 Apr 2010 21:07:38 +0000 (23:07 +0200)
commit61922ec59aceb3050fbdd799ff5d81a55243997f
treeb9a1d76d1884ac9259a4f2c7fae952c2c48a3051
parent33458dcf31cb06ea216c1672381100e1d6640903
Harden create_temp_filename() (version 2)

By hardening the create_temp_filename() function to check if the generated
filename exists and to create the temp file with only S_IRUSR|S_IWUSR bit
files set before calling the script, it should become even more difficult to
exploit such a scenario.

After a discussion on the mailing list, Fabian Knittel provided an enhanced
version of the inital patch which is added to this patch.

This patch also renames create_temp_filename() to create_temp_file(), as this
patch also creates the temporary file.  The function returns the filename of the
created file, or NULL on error.

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Signed-off-by: Fabian Knittel <fabian.knittel@avona.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
misc.c
misc.h