Use strtoul() instead and remove check for negative value. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- src/conntrack.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/conntrack.c b/src/conntrack.c index 4afccde4b027..859a4835580b 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -836,12 +836,11 @@ extern struct ctproto_handler ct_proto_unknown; static int parse_proto_num(const char *str) { + unsigned long val; char *endptr; - long val; - val = strtol(str, &endptr, 0); + val = strtoul(str, &endptr, 0); if (val > IPPROTO_RAW || - val < 0 || endptr == str || *endptr != '\0') return -1; -- 2.30.2