[Bug 206544] sendit "KPI" (in reality sendmsg(2); maybe sendto(2)) will fail with EINVAL if there's a mp->msg_control is not NULL and mp->msg_controllen is < sizeof(struct cmsghdr); is not documented in send(2)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jan 23 22:33:03 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206544

            Bug ID: 206544
           Summary: sendit "KPI" (in reality sendmsg(2); maybe sendto(2))
                    will fail with EINVAL if there's a mp->msg_control is
                    not NULL and mp->msg_controllen is < sizeof(struct
                    cmsghdr); is not documented in send(2)
           Product: Base System
           Version: 9.3-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: ngie at FreeBSD.org

769 static int
 770 sendit(td, s, mp, flags)
 771         struct thread *td;
 772         int s;
 773         struct msghdr *mp;
 774         int flags;
 775 {
 ...
 796         if (mp->msg_control) {
 797                 if (mp->msg_controllen < sizeof(struct cmsghdr)
 798 #ifdef COMPAT_OLDSOCK
 799                     && mp->msg_flags != MSG_COMPAT
 800 #endif
 801                 ) {
 802                         error = EINVAL;
 803                         goto bad;
 804                 }

The behavior on line 802 is not documented anywhere in send(2). It was driving
me nuts trying to figure out what was going on in
tools/regression/unix_cmsg:t_cmsg_len because the test fails on amd64 because
that conditional is tripped -_-...

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list