This is the mail archive of the
mailing list for the glibc project.
- To: james at and dot org
- Subject: Re: CMSG_NXTHDR()
- From: YOSHIFUJI Hideaki / $B5HF#1QL@(B
<yoshfuji at wide dot ad dot jp>
- Date: Sun, 13 May 2001 12:14:25 +0900
- Cc: libc-alpha at sources dot redhat dot com, usagi-core at linux-ipv6 dot org
- References: <20010512013616K.firstname.lastname@example.org><email@example.com>
In article <firstname.lastname@example.org> (at 12 May 2001 00:23:59 -0400), James Antill <email@example.com> says:
> My guess would that that either something is going wrong somewhere
> else and chopping the end of your data off, or you are running against
> an older version of libc that doesn't have the second check converted
> from a >= to > (the last line of context in your patch).
oops, sorry, ok at this point. But,
> I sent in a patch for the second test below a while ago (Message-ID:
> <firstname.lastname@example.org>) and thought about the first test (the
> one you are supplying a patch for) but I couldn't think of how a
> cmsghdr could only be the size of a cmsghdr?
> The header itself only contains:
RFC2292 implies we should accept the case which cmsg message without data.
| #define CMSG_NXTHDR(mhdr, cmsg) \
| ( ((cmsg) == NULL) ? CMSG_FIRSTHDR(mhdr) : \
| (((u_char *)(cmsg) + ALIGN((cmsg)->cmsg_len) \
| + ALIGN(sizeof(struct cmsghdr)) > \
| (u_char *)((mhdr)->msg_control) + (mhdr)->msg_controllen) ? \
| (struct cmsghdr *)NULL : \
| (struct cmsghdr *)((u_char *)(cmsg) + ALIGN((cmsg)->cmsg_len))) )
Glibc ignores last chunk without data.