summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2022-07-08 13:18:21 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2022-07-11 11:38:17 +0200
commitc23f117ed4414aa848f273a6e77850471ce21e0e (patch)
tree17a367398692c2b3190a525eb954485a32acc778 /src
parentba532383541d9eeeae6c3689df9f6813a4e44b03 (diff)
conntrack: slightly simplify parse_proto_num() by using strtoul()HEADmaster
Use strtoul() instead and remove check for negative value. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/conntrack.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/conntrack.c b/src/conntrack.c
index 4afccde..859a483 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;