This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: CMSG_NXTHDR()
- To: james at and dot org
- Subject: Re: CMSG_NXTHDR()
- From: YOSHIFUJI Hideaki / 吉藤英明
<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.yoshfuji@wide.ad.jp><nnk83n2o0w.fsf@code.and.org>
In article <nnk83n2o0w.fsf@code.and.org> (at 12 May 2001 00:23:59 -0400), James Antill <james@and.org> 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:
> <nny9uufcvs.fsf@code.and.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:
>
> length
> level
> type
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.
--
yoshfuji