]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: fix bad BUG_ON pattern
authorVictor Julien <vjulien@oisf.net>
Tue, 26 Apr 2022 19:33:52 +0000 (21:33 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 27 Apr 2022 10:18:24 +0000 (12:18 +0200)
cppcheck:

src/detect-engine-uint.c:73:13: warning: Conversion of string literal "unknown mode" to bool always evaluates to true. [incorrectStringBooleanError]
            BUG_ON("unknown mode");
            ^
src/detect-engine-uint.c:328:13: warning: Conversion of string literal "unknown mode" to bool always evaluates to true. [incorrectStringBooleanError]
            BUG_ON("unknown mode");
            ^
src/detect-pcre.c:291:25: warning: Conversion of string literal "Impossible captype" to bool always evaluates to true. [incorrectStringBooleanError]
                        BUG_ON("Impossible captype");
                        ^

Bug: #5291.

src/detect-engine-uint.c
src/detect-pcre.c

index d44c6bfaf2e11766f8b955b9a075d10f06704ae1..c8cf28dd72ab4f823c73dcbd70dff3bc6bf88def 100644 (file)
@@ -70,7 +70,7 @@ int DetectU32Match(const uint32_t parg, const DetectU32Data *du32)
             }
             return 0;
         default:
-            BUG_ON("unknown mode");
+            BUG_ON(1); // unknown mode
     }
     return 0;
 }
@@ -325,7 +325,7 @@ int DetectU8Match(const uint8_t parg, const DetectU8Data *du8)
             }
             return 0;
         default:
-            BUG_ON("unknown mode");
+            BUG_ON(1); // unknown mode
     }
     return 0;
 }
index 4311fcad52d80fe622eb365fe3336161e58c37b6..6f89ba846323a4d36e21827cce23f99e3a1586b9 100644 (file)
@@ -288,7 +288,7 @@ int DetectPcrePayloadMatch(DetectEngineThreadCtx *det_ctx, const Signature *s,
                                 (uint8_t *)str_ptr, capture_len,
                                 DETECT_VAR_TYPE_FLOW_POSTMATCH);
                     } else {
-                        BUG_ON("Impossible captype");
+                        BUG_ON(1); // Impossible captype
                         SCFree(str_ptr);
                     }
                 }