]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decoder-event: BUG_ON on table mismatches
authorVictor Julien <victor@inliniac.net>
Mon, 12 Sep 2016 16:15:01 +0000 (18:15 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 20 Sep 2016 07:41:31 +0000 (09:41 +0200)
Abort when the event enum and the name<>event table are not matching.

src/decode.c

index 345cb6cdae2e55eeb9e4f74314980e28ff68a4e4..95504d843db5e64c3d9a4ed74ed01d2294e1e753 100644 (file)
@@ -427,13 +427,14 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
         StatsRegisterCounter("defrag.ipv6.timeouts", tv);
     dtv->counter_defrag_max_hit =
         StatsRegisterCounter("defrag.max_frag_hits", tv);
-    
+
     int i = 0;
     for (i = 0; i < DECODE_EVENT_PACKET_MAX; i++) {
+        BUG_ON(i != (int)DEvents[i].code);
         dtv->counter_invalid_events[i] = StatsRegisterCounter(
                 DEvents[i].event_name, tv);
     }
-    
+
     return;
 }