public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: fweimer@redhat.com (Florian Weimer)
To: libc-stable@sourceware.org
Subject: [2.26 COMMITTED] resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
Date: Mon, 01 Jan 2018 00:00:00 -0000	[thread overview]
Message-ID: <20180517124336.63E0840272FB8@oldenburg.str.redhat.com> (raw)

(cherry picked from commit 583a27d525ae189bdfaa6784021b92a9a1dae12e)

2018-04-09  Florian Weimer  <fweimer@redhat.com>

	[BZ #23037]
	* resolv/res_send.c (send_dg): Use designated initializers instead
	of assignment to zero-initialize other fields of struct mmsghdr.

diff --git a/NEWS b/NEWS
index 410f0d1631..8c432b3e6e 100644
--- a/NEWS
+++ b/NEWS
@@ -118,6 +118,7 @@ The following bugs are resolved with this release:
   [22685] powerpc: Fix syscalls during early process initialization
   [22715] x86-64: Properly align La_x86_64_retval to VEC_SIZE
   [22774] malloc: Integer overflow in malloc (CVE-2018-6551)
+  [23037] resolv: Fully initialize struct mmsghdr in send_dg
 \f
 Version 2.26
 
diff --git a/resolv/res_send.c b/resolv/res_send.c
index b396aae03c..0ca02f9843 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -1152,25 +1152,27 @@ send_dg(res_state statp,
 		if (have_sendmmsg >= 0 && nwritten == 0 && buf2 != NULL
 		    && !single_request)
 		  {
-		    struct iovec iov[2];
-		    struct mmsghdr reqs[2];
-		    reqs[0].msg_hdr.msg_name = NULL;
-		    reqs[0].msg_hdr.msg_namelen = 0;
-		    reqs[0].msg_hdr.msg_iov = &iov[0];
-		    reqs[0].msg_hdr.msg_iovlen = 1;
-		    iov[0].iov_base = (void *) buf;
-		    iov[0].iov_len = buflen;
-		    reqs[0].msg_hdr.msg_control = NULL;
-		    reqs[0].msg_hdr.msg_controllen = 0;
-
-		    reqs[1].msg_hdr.msg_name = NULL;
-		    reqs[1].msg_hdr.msg_namelen = 0;
-		    reqs[1].msg_hdr.msg_iov = &iov[1];
-		    reqs[1].msg_hdr.msg_iovlen = 1;
-		    iov[1].iov_base = (void *) buf2;
-		    iov[1].iov_len = buflen2;
-		    reqs[1].msg_hdr.msg_control = NULL;
-		    reqs[1].msg_hdr.msg_controllen = 0;
+		    struct iovec iov =
+		      { .iov_base = (void *) buf, .iov_len = buflen };
+		    struct iovec iov2 =
+		      { .iov_base = (void *) buf2, .iov_len = buflen2 };
+		    struct mmsghdr reqs[2] =
+		      {
+			{
+			  .msg_hdr =
+			    {
+			      .msg_iov = &iov,
+			      .msg_iovlen = 1,
+			    },
+			},
+			{
+			  .msg_hdr =
+			    {
+			      .msg_iov = &iov2,
+			      .msg_iovlen = 1,
+			    }
+			},
+		      };
 
 		    int ndg = __sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
 		    if (__glibc_likely (ndg == 2))

                 reply	other threads:[~2018-05-17 12:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180517124336.63E0840272FB8@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-stable@sourceware.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).