Skip to content

Commit

Permalink
Use mkotemp() instead of mkstemp()
Browse files Browse the repository at this point in the history
This uses mkostemp() instead of mkstemp(), passing along the `O_CLOEXEC` flag,
which makes sure that the file descriptor is closed and won't be leaked into
any child process, which was previously an issue due to a missing fclose()
(#136).
  • Loading branch information
kbabioch committed Apr 10, 2018
1 parent d51124e commit 0b595ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pam_yubico.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
strcpy(tmpfile, userfile);
strcat(tmpfile, TMPFILE_SUFFIX);

fd = mkstemp(tmpfile);
fd = mkostemp(tmpfile, O_CLOEXEC);
if (fd < 0) {
DBG ("Cannot open file: %s (%s)", tmpfile, strerror(errno));
goto restpriv_out;
Expand Down

0 comments on commit 0b595ee

Please sign in to comment.