From 43b456dcb375319ad0e45931ddddd88fd3dd7ee1 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 28 Apr 2020 23:10:34 +0200 Subject: [PATCH] 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 Reviewed-By: Richard Lau Reviewed-By: Santiago Gimeno --- src/unix/udp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/unix/udp.c b/src/unix/udp.c index 085fae64..21b922fd 100644 --- a/src/unix/udp.c +++ b/src/unix/udp.c @@ -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