]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/app-layer-proto: fix prefilter check 11751/head
authorVictor Julien <vjulien@oisf.net>
Wed, 11 Sep 2024 08:18:58 +0000 (10:18 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 11 Sep 2024 08:19:01 +0000 (10:19 +0200)
Prefilter wasn't yet using `AppProtoEquals` which might lead to
mismatches with HTTP and DCERPC related signatures.

src/detect-app-layer-protocol.c

index c5924f07a1579381473838c35e8d77994555a0e7..bd0da13a23970d0c873741796e73ae90d6e687bd 100644 (file)
@@ -217,13 +217,13 @@ PrefilterPacketAppProtoMatch(DetectEngineThreadCtx *det_ctx, Packet *p, const vo
 
     if ((p->flags & PKT_PROTO_DETECT_TS_DONE) && (p->flowflags & FLOW_PKT_TOSERVER) &&
             p->flow->alproto_ts != ALPROTO_UNKNOWN) {
-        int r = (ctx->v1.u16[0] == p->flow->alproto_ts) ^ ctx->v1.u8[2];
+        int r = AppProtoEquals(ctx->v1.u16[0], p->flow->alproto_ts) ^ ctx->v1.u8[2];
         if (r) {
             PrefilterAddSids(&det_ctx->pmq, ctx->sigs_array, ctx->sigs_cnt);
         }
     } else if ((p->flags & PKT_PROTO_DETECT_TC_DONE) && (p->flowflags & FLOW_PKT_TOCLIENT) &&
                p->flow->alproto_tc != ALPROTO_UNKNOWN) {
-        int r = (ctx->v1.u16[0] == p->flow->alproto_tc) ^ ctx->v1.u8[2];
+        int r = AppProtoEquals(ctx->v1.u16[0], p->flow->alproto_tc) ^ ctx->v1.u8[2];
         if (r) {
             PrefilterAddSids(&det_ctx->pmq, ctx->sigs_array, ctx->sigs_cnt);
         }