upstream commit

zero cmsgbuf before use; we initialise the bits we use
 but valgrind still spams warning on it
This commit is contained in:
djm@openbsd.org 2015-02-25 23:05:47 +00:00 committed by Damien Miller
parent a63cfa2686
commit 6e6458b476
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: monitor_fdpass.c,v 1.19 2010/01/12 00:58:25 djm Exp $ */
/* $OpenBSD: monitor_fdpass.c,v 1.20 2015/02/25 23:05:47 djm Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@ -70,6 +70,7 @@ mm_send_fd(int sock, int fd)
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
memset(&cmsgbuf, 0, sizeof(cmsgbuf));
msg.msg_control = (caddr_t)&cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
cmsg = CMSG_FIRSTHDR(&msg);
@ -136,6 +137,7 @@ mm_receive_fd(int sock)
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
memset(&cmsgbuf, 0, sizeof(cmsgbuf));
msg.msg_control = &cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
#endif