]> git.meshlink.io Git - meshlink/commitdiff
Clear Ethernet header when reading packets from a tun device.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 9 Oct 2012 13:52:58 +0000 (15:52 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 9 Oct 2012 13:52:58 +0000 (15:52 +0200)
This fixes a warning from valgrind about uninitialized bytes, which were being
sent to other nodes.

src/bsd/device.c
src/linux/device.c
src/solaris/device.c

index c50005b2661f3d2b3bed45c9070c388d69d29e1d..4b33d7617f4a3b8f1e4e64d658cfa7fca671e152 100644 (file)
@@ -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;
                }
index 61785adb1b2cbf5f18f2f8c6087056958b48ca08..37a057d896a400ae923f3b865d7759f32ba79b72 100644 (file)
@@ -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:
index 6584b7f18186cec88b5dbbefb8078b03991e59ab..cb2ece799891c8fd62a6f1b0b7c872dd817e96e6 100644 (file)
@@ -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;