From: Guus Sliepen Date: Tue, 9 Oct 2012 13:52:58 +0000 (+0200) Subject: Clear Ethernet header when reading packets from a tun device. X-Git-Tag: release-1.1pre3~16 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=72642b40b3ad476101622da202b6f977a32b472f;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 c50005b2..4b33d761 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 = inlen + 14; break; @@ -269,6 +270,7 @@ static bool read_packet(vpn_packet_t *packet) { return false; } + memset(packet->data, 0, 12); packet->len = inlen + 10; break; } diff --git a/src/linux/device.c b/src/linux/device.c index 61785adb..37a057d8 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -131,6 +131,7 @@ static bool read_packet(vpn_packet_t *packet) { return false; } + memset(packet->data, 0, 12); packet->len = inlen + 10; break; case DEVICE_TYPE_TAP: diff --git a/src/solaris/device.c b/src/solaris/device.c index 6584b7f1..cb2ece79 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 = inlen + 14; device_total_in += packet->len;