stream: don't assume malformed TCP packets

This deep in the stream engine packets are valid, so don't check
for the tcph header in a packet as it confuses scan-build.

Do add a DEBUG_VALIDATE_BUG_ON so in QA we double check.
pull/3538/head
Victor Julien 6 years ago
parent b3cd2e7e81
commit fe45726635

@ -1703,6 +1703,9 @@ int StreamTcpReassembleHandleSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_
Packet *p, PacketQueue *pq)
{
SCEnter();
DEBUG_VALIDATE_BUG_ON(p->tcph == NULL);
SCLogDebug("ssn %p, stream %p, p %p, p->payload_len %"PRIu16"",
ssn, stream, p, p->payload_len);
@ -1722,9 +1725,9 @@ int StreamTcpReassembleHandleSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_
dir = UPDATE_DIR_PACKET;
} else if (p->flags & PKT_PSEUDO_STREAM_END) {
dir = UPDATE_DIR_PACKET;
} else if (p->tcph && (p->tcph->th_flags & TH_RST)) { // accepted rst
} else if (p->tcph->th_flags & TH_RST) { // accepted rst
dir = UPDATE_DIR_PACKET;
} else if (p->tcph && (p->tcph->th_flags & TH_FIN) && ssn->state > TCP_TIME_WAIT) {
} else if ((p->tcph->th_flags & TH_FIN) && ssn->state > TCP_TIME_WAIT) {
dir = UPDATE_DIR_PACKET;
} else if (ssn->state == TCP_CLOSED) {
dir = UPDATE_DIR_BOTH;

Loading…
Cancel
Save