From 5f681022c9e6c670568b882d36f971c84d8e84d8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 10 Dec 2019 14:38:41 +0100 Subject: [PATCH] Invert skipPacket condition so code matches Signed-off-by: Jason A. Donenfeld --- wintun.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wintun.c b/wintun.c index e2dd828..624de2f 100644 --- a/wintun.c +++ b/wintun.c @@ -242,8 +242,9 @@ TunSendNetBufferLists( { PacketsCount++; UINT PacketSize = NET_BUFFER_DATA_LENGTH(Nb); - if (PacketSize <= TUN_MAX_IP_PACKET_SIZE) - RequiredRingSpace += TUN_ALIGN(sizeof(TUN_PACKET) + PacketSize); + if (PacketSize > TUN_MAX_IP_PACKET_SIZE) + continue; /* The same condition holds down below, where we `goto skipPacket`. */ + RequiredRingSpace += TUN_ALIGN(sizeof(TUN_PACKET) + PacketSize); } }