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".
---
src/openvpn/manage.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index a4f99c9a..103ccadc 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -2092,7 +2092,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 {
@@ -2124,7 +2124,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;
--
2.26.2
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel