]> 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>
Tue, 3 May 2022 11:30:19 +0000 (13:30 +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.
(cherry picked from commit 7e2ed11a11cae89bc07e9a25425192581687993d)

src/detect-engine-uint.c

index 51513d877dc84148a61fa9a89320d808a49815aa..2979cf29eb7110f44e2a7c55ef98d20d04edd371 100644 (file)
@@ -60,7 +60,7 @@ int DetectU32Match(const uint32_t parg, const DetectU32Data *du32)
             }
             return 0;
         default:
-            BUG_ON("unknown mode");
+            BUG_ON(1); // unknown mode
     }
     return 0;
 }
@@ -255,7 +255,7 @@ int DetectU8Match(const uint8_t parg, const DetectU8Data *du8)
             }
             return 0;
         default:
-            BUG_ON("unknown mode");
+            BUG_ON(1); // unknown mode
     }
     return 0;
 }