]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/engine: fix whitelisting check
authorVictor Julien <vjulien@oisf.net>
Fri, 12 Jan 2024 07:03:06 +0000 (12:33 +0530)
committerVictor Julien <victor@inliniac.net>
Mon, 4 Mar 2024 10:50:30 +0000 (11:50 +0100)
In the commit 4a00ae607, the whitelisting check was updated in a quest
to make use of the conditional better but it made things worse as every
range would be whitelisted as long as it had any of the default
whitelisted port which is very common.

src/detect-engine-build.c

index 605a5682385229693c9f6b2069c65e137afd7b29..24ddc0af4469df9af93556e0149f54c6a83bf67b 100644 (file)
@@ -1076,7 +1076,7 @@ static int PortIsWhitelisted(const DetectEngineCtx *de_ctx,
     while (w) {
         /* Make sure the whitelist port falls in the port range of a */
         DEBUG_VALIDATE_BUG_ON(a->port > a->port2);
-        if (w->port >= a->port && w->port <= a->port2) {
+        if (a->port == w->port && w->port2 == a->port2) {
             return 1;
         }
         w = w->next;