]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
signature: error for rules with illegal port
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 6 Jun 2019 13:42:47 +0000 (15:42 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 8 Jun 2019 19:16:35 +0000 (21:16 +0200)
Fixes #2080

src/detect-engine-port.c

index 36083e5bc117c0b55ec04e1deef43a7352efff5e..d935d9074072c3249f7f8ff94d79d457343abd49 100644 (file)
@@ -1465,7 +1465,10 @@ error:
  */
 int DetectPortIsValidRange(char *port)
 {
-    if(atoi(port) >= 0 && atoi(port) <= 65535)
+    char *end;
+    long r = strtol(port, &end, 10);
+
+    if(*end == 0 && r >= 0 && r <= 65535)
         return 1;
     else
         return 0;