From bceaa804d57ac88f5201886d48738975ee2ae8c2 Mon Sep 17 00:00:00 2001 From: Mathew Heard Date: Tue, 29 Jun 2021 15:03:50 +1000 Subject: [PATCH] Fail early in send_udp_probe_packet(). --- src/net_packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net_packet.c b/src/net_packet.c index ac70d6be..8a5460cb 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -1085,14 +1085,14 @@ static void try_sptps(node_t *n) { static void send_udp_probe_packet(node_t *n, int len) { vpn_packet_t packet; - packet.offset = DEFAULT_PACKET_OFFSET; - memset(DATA(&packet), 0, 14); if(len > sizeof(packet.data)) { logger(DEBUG_TRAFFIC, LOG_INFO, "Truncating probe length %d to %s (%s)", len, n->name, n->hostname); len = sizeof(packet.data); } + packet.offset = DEFAULT_PACKET_OFFSET; + memset(DATA(&packet), 0, 14); randomize(DATA(&packet) + 14, len - 14); packet.len = len; packet.priority = 0; -- 2.20.1