CMSG_NXTHDR()
nny9uufcvs.fsf@code.and.org
nny9uufcvs.fsf@code.and.org
Sat May 12 20:15:00 GMT 2001
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
More information about the Libc-alpha
mailing list