]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
invalidate sigs if depth > content_length
authorAnoop Saldanha <poonaatsoc@gmail.com>
Wed, 11 Jul 2012 14:39:24 +0000 (20:09 +0530)
committerVictor Julien <victor@inliniac.net>
Mon, 6 Aug 2012 14:18:31 +0000 (16:18 +0200)
src/detect-depth.c

index 7ab89966b7dcfd3c3eb983a26d6114fad7d30743..85fadb69e8d2f6daa3bdd40de1a88e64021b48cc 100644 (file)
@@ -162,9 +162,11 @@ static int DetectDepthSetup (DetectEngineCtx *de_ctx, Signature *s, char *depths
             } else {
                 cd->depth = (uint32_t)atoi(str);
                 if (cd->depth < cd->content_len) {
-                    cd->depth = cd->content_len;
-                    SCLogDebug("depth increased to %"PRIu32" to match pattern len ",
-                               cd->depth);
+                    uint32_t content_len = cd->content_len;
+                    SCLogError(SC_ERR_INVALID_SIGNATURE, "depth - %"PRIu16
+                               " smaller than content length - %"PRIu32,
+                               cd->depth, content_len);
+                    goto error;
                 }
                 /* Now update the real limit, as depth is relative to the offset */
                 cd->depth += cd->offset;