Skip to content

Commit

Permalink
Avoid potentially following a symlink with open()
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Kihlman committed May 15, 2019
1 parent bec4e43 commit 9d24c96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ykpamcfg.c
Expand Up @@ -250,7 +250,7 @@ do_add_hmac_chalresp(YK_KEY *yk, uint8_t slot, bool verbose, char *output_dir, u

umask(077);

fd = open (fn, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR);
fd = open (fn, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_NOCTTY, S_IRUSR | S_IWUSR);
if (fd < 0) {
fprintf (stderr, "Failed to open '%s' for writing: %s\n", fn, strerror (errno));
goto out;
Expand Down

0 comments on commit 9d24c96

Please sign in to comment.