Skip to content

Commit f0b0d89

Browse files
author
bol-van
committed
nfqws: relax stun detector
1 parent a08a358 commit f0b0d89

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

nfq/protocol.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ bool IsStunMessage(const uint8_t *data, size_t len)
10171017
{
10181018
return len>=20 && // header size
10191019
(data[0]&0xC0)==0 && // 2 most significant bits must be zeroes
1020-
(data[3]&0b11)==0 && // length must be a multiple of 4
1021-
ntohl(*(uint32_t*)(&data[4]))==0x2112A442 && // magic cookie
1022-
ntohs(*(uint16_t*)(&data[2]))==len-20;
1020+
(data[3]&3)==0 && // length must be a multiple of 4
1021+
pntoh32(data+4)==0x2112A442 && // magic cookie
1022+
pntoh16(data+2)<=(len-20);
10231023
}

0 commit comments

Comments
 (0)