extra: tcp: insufficient sanitization in nfq_tcp_get_payload()
Pablo Neira Ayuso
maintainerPATCH 1/1 extra: tcp: insufficient sanitization in nfq_tcp_get_payload()
Similar to 7335cbe ("extra: fix wrong implementation in nfq_udp_get_payload").
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/extra/tcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
src/extra/tcp.c +7 -3
@@ -59,13 +59,17 @@ EXPORT_SYMBOL(nfq_tcp_get_hdr);*/ void *nfq_tcp_get_payload (struct tcphdr *tcph,struct pkt_buff *pktb) { -unsigned int doff = tcph->doff *4 ; +unsigned int len = tcph->doff *4 ; + +/* TCP packet is too short */ +if (len <sizeof (struct tcphdr )) +return NULL ;/* malformed TCP data offset. */ -if (pktb->transport_header + doff >= pktb->tail) +if (pktb->transport_header + len > pktb->tail)return NULL ; -return pktb->transport_header + doff; +return pktb->transport_header + len; }EXPORT_SYMBOL (nfq_tcp_get_payload);
Signature · 1 line
1.7.10.4