From: Guus Sliepen Date: Tue, 9 Oct 2012 19:02:49 +0000 (+0200) Subject: Clear Ethernet header when reading packets from a tun device. X-Git-Tag: release-1.0.20~18 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=8793fb7d43161f4d5358ff73b7a4937ad7e642e2;p=tinc Clear Ethernet header when reading packets from a tun device. This fixes a warning from valgrind about uninitialized bytes, which were being sent to other nodes. --- diff --git a/src/bsd/device.c b/src/bsd/device.c index d6dd0554..c91eb5e2 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -238,6 +238,7 @@ static bool read_packet(vpn_packet_t *packet) { return false; } + memset(packet->data, 0, 12); packet->len = lenin + 14; break; @@ -269,6 +270,7 @@ static bool read_packet(vpn_packet_t *packet) { return false; } + memset(packet->data, 0, 12); packet->len = lenin + 10; break; } diff --git a/src/linux/device.c b/src/linux/device.c index 5ae89478..f770f7fa 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -155,6 +155,7 @@ static bool read_packet(vpn_packet_t *packet) { return false; } + memset(packet->data, 0, 12); packet->len = lenin + 10; break; case DEVICE_TYPE_TAP: diff --git a/src/solaris/device.c b/src/solaris/device.c index 969b514a..26121e27 100644 --- a/src/solaris/device.c +++ b/src/solaris/device.c @@ -151,6 +151,7 @@ static bool read_packet(vpn_packet_t *packet) { return false; } + memset(packet->data, 0, 12); packet->len = lenin + 14; device_total_in += packet->len;