From c7ddee04097d244a29dc18690847541d3c078bf1 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Fri, 19 Aug 2022 20:17:59 +0200 Subject: [PATCH] fix possible buffer overflow Signed-off-by: Toni Uhlig --- probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/probe.c b/probe.c index fdf94243..aa1ac9d9 100644 --- a/probe.c +++ b/probe.c @@ -169,13 +169,13 @@ static int is_openvpn_protocol (const char*p,ssize_t len, struct sslhcfg_protoco * whereas the packet id is increased with every transmitted datagram. */ - if (len <= OVPN_HARD_RESET_PACKET_ID_OFFSET(OVPN_HMAC_128)) + if (len <= OVPN_HARD_RESET_PACKET_ID_OFFSET(OVPN_HMAC_128) + 4) return PROBE_NEXT; if (ntohl(*(uint32_t*)(p + OVPN_HARD_RESET_PACKET_ID_OFFSET(OVPN_HMAC_128))) <= 5u) return PROBE_MATCH; - if (len <= OVPN_HARD_RESET_PACKET_ID_OFFSET(OVPN_HMAC_160)) + if (len <= OVPN_HARD_RESET_PACKET_ID_OFFSET(OVPN_HMAC_160) + 4) return PROBE_NEXT; if (ntohl(*(uint32_t*)(p + OVPN_HARD_RESET_PACKET_ID_OFFSET(OVPN_HMAC_160))) <= 5u)