1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2024-11-28 15:24:13 +01:00

Avoid potentially following a symlink with open()

This commit is contained in:
Gabriel Kihlman 2019-05-15 12:50:05 +02:00
parent bec4e43732
commit 9d24c966c3
No known key found for this signature in database
GPG Key ID: C59A56181B3BF1F7

View File

@ -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;