summaryrefslogtreecommitdiff
path: root/sysdep/unix/io.c
diff options
context:
space:
mode:
authorPavel Tvrdík <pawel.tvrdik@gmail.com>2016-01-27 12:14:46 +0100
committerPavel Tvrdík <pawel.tvrdik@gmail.com>2016-01-27 12:41:59 +0100
commit966ca6143b8648a29e77b6328133bc3f245d50ee (patch)
tree7880ad664708412e5d36b43f5d68183eae4d9826 /sysdep/unix/io.c
parentd82987d12e96db887033deabb6c46f07db64e1b8 (diff)
io.c: fix reads from uninitialized memory
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r--sysdep/unix/io.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 8f61fc68..cbfb47d5 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1204,7 +1204,7 @@ sk_setup(sock *s)
if (s->iface)
{
#ifdef SO_BINDTODEVICE
- struct ifreq ifr;
+ struct ifreq ifr = {};
strcpy(ifr.ifr_name, s->iface->name);
if (setsockopt(s->fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0)
ERR("SO_BINDTODEVICE");
@@ -1564,7 +1564,8 @@ sk_sendmsg(sock *s)
{
struct iovec iov = {s->tbuf, s->tpos - s->tbuf};
byte cmsg_buf[CMSG_TX_SPACE];
- sockaddr dst;
+ bzero(cmsg_buf, sizeof(cmsg_buf));
+ sockaddr dst = {};
sockaddr_fill(&dst, fam_to_af[s->fam], s->daddr, s->iface, s->dport);