hurd: Do not take any flag from the CMSG_DATA
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 24 Apr 2023 22:14:58 +0000 (00:14 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 24 Apr 2023 22:14:58 +0000 (00:14 +0200)
As fixed in 0822e3552a78 ("hurd: Don't pass FD_CLOEXEC in CMSG_DATA"),
senders currently don't have any flag to pass.  We shouldn't blindly take
random flags that senders could be erroneously giving us.

sysdeps/mach/hurd/recvmsg.c

index e06b0fe3ba3a3e64cd92d3644ff2cba8377c2859..4254dca627117f07fe02e530d309f5662e08af0f 100644 (file)
@@ -201,8 +201,10 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags)
            err = reauthenticate (ports[i], &newports[newfds]);
            if (err)
              goto cleanup;
+           /* We do not currently take any flag from the sender.  */
            fds[j] = opened_fds[newfds] = _hurd_intern_fd (newports[newfds],
-                                                          fds[j] | fd_flags,
+                                                          (fds[j] & 0)
+                                                          | fd_flags,
                                                           0);
            if (fds[j] == -1)
              {