]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: handle very large byte_extract'ed values in isdataat
authorVictor Julien <victor@inliniac.net>
Sat, 21 Oct 2017 08:16:30 +0000 (10:16 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 24 Oct 2017 11:47:02 +0000 (13:47 +0200)
src/detect-engine-content-inspection.c

index d6e355b2e3211912c801aa7bc90171ca51db9e44..ef878b2f65bcb41178016a3071ed87008afe3ff2 100644 (file)
@@ -365,7 +365,16 @@ int DetectEngineContentInspection(DetectEngineCtx *de_ctx, DetectEngineThreadCtx
         const DetectIsdataatData *id = (DetectIsdataatData *)smd->ctx;
         uint32_t dataat = id->dataat;
         if (id->flags & ISDATAAT_OFFSET_BE) {
-            dataat = det_ctx->bj_values[dataat];
+            uint64_t be_value = det_ctx->bj_values[dataat];
+            if (be_value >= 100000000) {
+                if ((id->flags & ISDATAAT_NEGATED) == 0) {
+                    SCLogDebug("extracted value %"PRIu64" very big: no match", be_value);
+                    goto no_match;
+                }
+                SCLogDebug("extracted value way %"PRIu64" very big: match", be_value);
+                goto match;
+            }
+            dataat = (uint32_t)be_value;
             SCLogDebug("isdataat: using value %u from byte_extract local_id %u", dataat, id->dataat);
         }