From f0b0d89f02f44bb047fbfde5d96e9a1fc38e46f0 Mon Sep 17 00:00:00 2001 From: bol-van Date: Tue, 24 Feb 2026 10:13:53 +0300 Subject: [PATCH] nfqws: relax stun detector --- nfq/protocol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nfq/protocol.c b/nfq/protocol.c index 55f48813..fd4ce038 100644 --- a/nfq/protocol.c +++ b/nfq/protocol.c @@ -1017,7 +1017,7 @@ bool IsStunMessage(const uint8_t *data, size_t len) { return len>=20 && // header size (data[0]&0xC0)==0 && // 2 most significant bits must be zeroes - (data[3]&0b11)==0 && // length must be a multiple of 4 - ntohl(*(uint32_t*)(&data[4]))==0x2112A442 && // magic cookie - ntohs(*(uint16_t*)(&data[2]))==len-20; + (data[3]&3)==0 && // length must be a multiple of 4 + pntoh32(data+4)==0x2112A442 && // magic cookie + pntoh16(data+2)<=(len-20); }