]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Adding nofollow to opens 483/head
authored neville <ed@s5h.net>
Fri, 31 Dec 2021 22:40:13 +0000 (22:40 +0000)
committered neville <ed@s5h.net>
Sat, 1 Jan 2022 21:13:41 +0000 (21:13 +0000)
libmisc/copydir.c

index f2130bcacad26d4ad1168faf9ae5077d58ad6113..a296d925dcd61b0e8e13e614aa456cb0e40e28d3 100644 (file)
@@ -741,7 +741,7 @@ static int copy_file (const char *src, const char *dst,
        char buf[1024];
        ssize_t cnt;
 
-       ifd = open (src, O_RDONLY);
+       ifd = open (src, O_RDONLY|O_NOFOLLOW);
        if (ifd < 0) {
                return -1;
        }
@@ -751,7 +751,7 @@ static int copy_file (const char *src, const char *dst,
                return -1;
        }
 #endif                         /* WITH_SELINUX */
-       ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, statp->st_mode & 07777);
+       ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, statp->st_mode & 07777);
        if (   (ofd < 0)
            || (fchown_if_needed (ofd, statp,
                                  old_uid, new_uid, old_gid, new_gid) != 0)