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://git.librecmc.org/?a=commitdiff_plain;h=72642b40b3ad476101622da202b6f977a32b472f;p=oweals%2Ftinc.git 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 c50005b..4b33d76 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 61785ad..37a057d 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 6584b7f..cb2ece7 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;