unix: fully initialize struct msghdr

Commit 3d713663 ("freebsd,linux: add recvmmsg() + sendmmsg() udp
implementation") forgot to zero some of the members of the msghdr
struct. It seems to work by accident, not by design.

PR-URL: https://github.com/libuv/libuv/pull/2819
Refs: https://github.com/libuv/libuv/pull/2818
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Ben Noordhuis 2020-04-28 23:10:34 +02:00
parent db96a61c26
commit 43b456dcb3

View File

@ -202,6 +202,9 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
msgs[k].msg_hdr.msg_iovlen = 1;
msgs[k].msg_hdr.msg_name = peers + k;
msgs[k].msg_hdr.msg_namelen = sizeof(peers[0]);
msgs[k].msg_hdr.msg_control = NULL;
msgs[k].msg_hdr.msg_controllen = 0;
msgs[k].msg_hdr.msg_flags = 0;
}
do