Check for tcp th_off < 5

This commit is contained in:
dmiller 2026-06-26 22:06:05 +00:00
parent 4651a54b4b
commit b5c54d9687

View file

@ -1908,7 +1908,8 @@ bool HostOsScan::processResp(HostOsScanStats *hss, const u8 *pkt, unsigned int l
if (len < sizeof(tcp))
return false;
memcpy(&tcp, l4pkt, sizeof(tcp));
if (len < (unsigned int)(4 * tcp.th_off))
const unsigned int tcphlen = 4 * tcp.th_off;
if (tcphlen < sizeof(tcp) || len < tcphlen)
return false;
testno = ntohs(tcp.th_dport) - tcpPortBase;