[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hurd, commited] socket: Fix tst-cmsghdr-skeleton.c use of cmsg_len
From: |
Andreas Schwab |
Subject: |
Re: [hurd, commited] socket: Fix tst-cmsghdr-skeleton.c use of cmsg_len |
Date: |
Mon, 01 May 2023 16:03:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Mai 01 2023, Samuel Thibault wrote:
> Andreas Schwab, le lun. 01 mai 2023 15:38:45 +0200, a ecrit:
>> On Mai 01 2023, Samuel Thibault wrote:
>>
>> > cmsg_len is supposed to be socklen_t according to standards, but it was
>> > made
>> > size_t on Linux, see BZ 16919. For ports that have it socklen_t, SIZE_MAX
>> > is
>> > too large. We can however explicitly cast it to the type of cmsg_len so it
>> > will fit according to that type.
>> > ---
>> > socket/tst-cmsghdr-skeleton.c | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/socket/tst-cmsghdr-skeleton.c b/socket/tst-cmsghdr-skeleton.c
>> > index 296a0a8581..9516139f87 100644
>> > --- a/socket/tst-cmsghdr-skeleton.c
>> > +++ b/socket/tst-cmsghdr-skeleton.c
>> > @@ -49,7 +49,7 @@ RUN_TEST_FUNCNAME (CMSG_NXTHDR_IMPL) (void)
>> > /* The first header length is so big, using it would cause an overflow.
>> > */
>> > cmsg = CMSG_FIRSTHDR (&m);
>> > TEST_VERIFY_EXIT ((char *) cmsg == cmsgbuf);
>> > - cmsg->cmsg_len = SIZE_MAX;
>> > + cmsg->cmsg_len = (__typeof (cmsg->cmsg_len)) SIZE_MAX;
>>
>> What does that fix?
>
> 64bit hurd, where cmsg_len is socklen_t as the standards require (thus
> 32bit).
And what does it fix?
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."