aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArne Schwabe2021-01-05 14:17:58 +0100
committerGert Doering2021-01-18 12:54:03 +0100
commita65d39bfd27cf5612e55dd536dd189e1a62624c2 (patch)
treea76c1fef438de142ad47914e36a79bdb663e08d9 /src
parent2f2df474158b6c24325a47334fc8b5eb77a69b85 (diff)
downloadopenvpn-a65d39bfd27cf5612e55dd536dd189e1a62624c2.zip
openvpn-a65d39bfd27cf5612e55dd536dd189e1a62624c2.tar.gz
Zero initialise msghdr prior to calling sendmesg
This ensure that all unused fields in msg are zero. Spotted by Coverity: Using uninitialized value "msg". Field "msg.msg_flags" is uninitialized when calling "sendmsg". Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Antonio Quartulli <antonio@openvpn.net> Message-Id: <20210105131758.20311-1-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21418.html Signed-off-by: Gert Doering <gert@greenie.muc.de> (cherry picked from commit aa58035a955a2ae7ffa2b93ca2c8d2c6e5472695)
Diffstat (limited to 'src')
-rw-r--r--src/openvpn/manage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 11d5aa7..d86b6a7 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -2102,7 +2102,7 @@ man_io_error(struct management *man, const char *prefix)
static ssize_t
man_send_with_fd(int fd, void *ptr, size_t nbytes, int flags, int sendfd)
{
- struct msghdr msg;
+ struct msghdr msg = { 0 };
struct iovec iov[1];
union {
@@ -2134,7 +2134,7 @@ man_send_with_fd(int fd, void *ptr, size_t nbytes, int flags, int sendfd)
static ssize_t
man_recv_with_fd(int fd, void *ptr, size_t nbytes, int flags, int *recvfd)
{
- struct msghdr msghdr;
+ struct msghdr msghdr = { 0 };
struct iovec iov[1];
ssize_t n;