arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh1579354.patch

147e83
commit 583a27d525ae189bdfaa6784021b92a9a1dae12e
147e83
Author: Florian Weimer <fweimer@redhat.com>
147e83
Date:   Mon Apr 9 10:08:07 2018 +0200
147e83
147e83
    resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
147e83
147e83
diff --git a/resolv/res_send.c b/resolv/res_send.c
147e83
index 478d542419566574..05c7ba511b0383c1 100644
147e83
--- a/resolv/res_send.c
147e83
+++ b/resolv/res_send.c
147e83
@@ -1154,25 +1154,27 @@ send_dg(res_state statp,
147e83
 		if (have_sendmmsg >= 0 && nwritten == 0 && buf2 != NULL
147e83
 		    && !single_request)
147e83
 		  {
147e83
-		    struct iovec iov[2];
147e83
-		    struct mmsghdr reqs[2];
147e83
-		    reqs[0].msg_hdr.msg_name = NULL;
147e83
-		    reqs[0].msg_hdr.msg_namelen = 0;
147e83
-		    reqs[0].msg_hdr.msg_iov = &iov[0];
147e83
-		    reqs[0].msg_hdr.msg_iovlen = 1;
147e83
-		    iov[0].iov_base = (void *) buf;
147e83
-		    iov[0].iov_len = buflen;
147e83
-		    reqs[0].msg_hdr.msg_control = NULL;
147e83
-		    reqs[0].msg_hdr.msg_controllen = 0;
147e83
-
147e83
-		    reqs[1].msg_hdr.msg_name = NULL;
147e83
-		    reqs[1].msg_hdr.msg_namelen = 0;
147e83
-		    reqs[1].msg_hdr.msg_iov = &iov[1];
147e83
-		    reqs[1].msg_hdr.msg_iovlen = 1;
147e83
-		    iov[1].iov_base = (void *) buf2;
147e83
-		    iov[1].iov_len = buflen2;
147e83
-		    reqs[1].msg_hdr.msg_control = NULL;
147e83
-		    reqs[1].msg_hdr.msg_controllen = 0;
147e83
+		    struct iovec iov =
147e83
+		      { .iov_base = (void *) buf, .iov_len = buflen };
147e83
+		    struct iovec iov2 =
147e83
+		      { .iov_base = (void *) buf2, .iov_len = buflen2 };
147e83
+		    struct mmsghdr reqs[2] =
147e83
+		      {
147e83
+			{
147e83
+			  .msg_hdr =
147e83
+			    {
147e83
+			      .msg_iov = &iov,
147e83
+			      .msg_iovlen = 1,
147e83
+			    },
147e83
+			},
147e83
+			{
147e83
+			  .msg_hdr =
147e83
+			    {
147e83
+			      .msg_iov = &iov2,
147e83
+			      .msg_iovlen = 1,
147e83
+			    }
147e83
+			},
147e83
+		      };
147e83
 
147e83
 		    int ndg = __sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
147e83
 		    if (__glibc_likely (ndg == 2))