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.librecmc.org/?a=commitdiff_plain;h=8793fb7d43161f4d5358ff73b7a4937ad7e642e2;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 d6dd055..c91eb5e 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 5ae8947..f770f7f 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 969b514..26121e2 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;