public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: libc-alpha@sourceware.org,  bug-hurd@gnu.org,  commit-hurd@gnu.org
Subject: Re: [hurd,commited] socket: Fix tst-cmsghdr-skeleton.c use of cmsg_len
Date: Mon, 01 May 2023 15:38:45 +0200	[thread overview]
Message-ID: <874jow41ei.fsf@igel.home> (raw)
In-Reply-To: <20230501130607.3846669-1-samuel.thibault@ens-lyon.org> (Samuel Thibault's message of "Mon, 1 May 2023 15:06:07 +0200")

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?

-- 
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."

  reply	other threads:[~2023-05-01 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 13:06 Samuel Thibault
2023-05-01 13:38 ` Andreas Schwab [this message]
2023-05-01 13:43   ` [hurd, commited] " Samuel Thibault
2023-05-01 14:03     ` Andreas Schwab
2023-05-01 16:34       ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jow41ei.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=bug-hurd@gnu.org \
    --cc=commit-hurd@gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=samuel.thibault@ens-lyon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).