]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: checks for overflow when comparing signatures priorities
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 27 Aug 2020 15:11:10 +0000 (17:11 +0200)
committerJeff Lucovsky <jeff@lucovsky.org>
Sun, 20 Sep 2020 14:44:47 +0000 (10:44 -0400)
(cherry picked from commit 16742394424e8c9654708fbc93b990b9ddc70dff)

src/detect-engine-sigorder.c

index 642df90f7719978da611066f18d5e7f692a4e4f0..90a84d0628453832783e12065053ab600459f791 100644 (file)
@@ -682,7 +682,12 @@ static int SCSigOrderByIPPairbitsCompare(SCSigSignatureWrapper *sw1,
 static int SCSigOrderByPriorityCompare(SCSigSignatureWrapper *sw1,
                                        SCSigSignatureWrapper *sw2)
 {
-    return sw2->sig->prio - sw1->sig->prio;
+    if (sw1->sig->prio > sw2->sig->prio) {
+        return -1;
+    } else if (sw1->sig->prio < sw2->sig->prio) {
+        return 1;
+    }
+    return 0;
 }
 
 /**