diff --git a/base/tcppack.c b/base/tcppack.c index bfeb268..fcdc360 100644 --- a/base/tcppack.c +++ b/base/tcppack.c @@ -242,7 +242,12 @@ static int process_data_segment(conn,handler,p,stream,direction) long l; l=p->len - p->tcp->th_off * 4; - + + if(l < 0) { + printf("Malformed packet, computed TCP segment size is negative, skipping ...\n"); + return(0); + } + if(stream->close){ DBG((0,"Rejecting packet received after FIN: %u:%u(%u)", ntohl(p->tcp->th_seq),ntohl(p->tcp->th_seq+l),l));