From: Philippe Antoine Date: Thu, 6 Jun 2019 13:42:47 +0000 (+0200) Subject: signature: error for rules with illegal port X-Git-Tag: suricata-5.0.0-rc1~409 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a74e9edcc6a8acba1616b53f14a0dec41bdf4ac;p=thirdparty%2Fsuricata.git signature: error for rules with illegal port Fixes #2080 --- diff --git a/src/detect-engine-port.c b/src/detect-engine-port.c index 36083e5bc1..d935d90740 100644 --- a/src/detect-engine-port.c +++ b/src/detect-engine-port.c @@ -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;