From 0824b0413455b668777e83cabe9fbc0ea81c400a Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 24 Oct 2019 14:51:48 +0200 Subject: [PATCH] filestore: don't assume flow is TCP Filestore can be used by UDP based protocols as well. NFSv2 is one that Suricata supports. Bug #3277. --- src/detect-filestore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/detect-filestore.c b/src/detect-filestore.c index a4bdc249d2..c2d1340c22 100644 --- a/src/detect-filestore.c +++ b/src/detect-filestore.c @@ -209,10 +209,11 @@ static int DetectFilestorePostMatch(DetectEngineThreadCtx *det_ctx, #endif } - /* set filestore depth for stream reassembling */ - TcpSession *ssn = (TcpSession *)p->flow->protoctx; - TcpSessionSetReassemblyDepth(ssn, FileReassemblyDepth()); - + if (p->proto == IPPROTO_TCP && p->flow->protoctx != NULL) { + /* set filestore depth for stream reassembling */ + TcpSession *ssn = (TcpSession *)p->flow->protoctx; + TcpSessionSetReassemblyDepth(ssn, FileReassemblyDepth()); + } if (p->flowflags & FLOW_PKT_TOCLIENT) flags |= STREAM_TOCLIENT; else -- 2.47.2