diff options
author | Jim Meyering <jim@meyering.net> | 1998-03-11 11:54:11 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-03-11 11:54:11 +0000 |
commit | cb3b5ed48689e9dbd24089451839d0ad290b8a9e (patch) | |
tree | 0c56aa467869dddc7b49654226d129e0e08b3959 | |
parent | 7ee8ed7e378e2a5a9495bc17692fc41f266c14ac (diff) | |
download | coreutils-cb3b5ed48689e9dbd24089451839d0ad290b8a9e.tar.gz |
(save_stdin): Open temporary file exclusively, to
foil a common denial-of-service attack.
From Paul Eggert.
-rw-r--r-- | src/tac.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -418,7 +418,7 @@ save_stdin (FILE **g_tmp, char **g_tempfile) sprintf (template, "%s/tacXXXXXX", tempdir); tempfile = mktemp (template); - fd = creat (tempfile, 0600); + fd = open (tempfile, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600); if (fd == -1 || (tmp = fdopen (fd, "rw")) == NULL) error (EXIT_FAILURE, errno, "%s", tempfile); tmp = fdopen (fd, "rw"); |