summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2016-02-01 12:02:36 +0100
committerFlorian Westphal <fw@strlen.de>2016-02-17 15:53:08 +0100
commita5229aba55d8622ef12377f0a59827a709338270 (patch)
treea73f89311d62637ec805828687b68da8741d0212
parent065c01a09fb8b3d0f90707541b63d7ee42079fca (diff)
meta: fix error checks in tc handle parser
'meta priority foobar' did not return an error -- instead we used min/max values with undefined content. Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/meta.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/meta.c b/src/meta.c
index 8cbc9745..b8db0f89 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -100,17 +100,17 @@ static struct error_record *tchandle_type_parse(const struct expr *sym,
else if (strcmp(sym->identifier, "none") == 0)
handle = TC_H_UNSPEC;
else if (sym->identifier[0] == ':') {
- if (sscanf(sym->identifier, ":%04x", &handle) < 0)
+ if (sscanf(sym->identifier, ":%04x", &handle) != 1)
goto err;
} else if (sym->identifier[strlen(sym->identifier)-1] == ':') {
- if (sscanf(sym->identifier, "%04x:", &handle) < 0)
+ if (sscanf(sym->identifier, "%04x:", &handle) != 1)
goto err;
handle <<= 16;
} else {
uint32_t min, max;
- if (sscanf(sym->identifier, "%04x:%04x", &min, &max) < 0)
+ if (sscanf(sym->identifier, "%04x:%04x", &max, &min) != 2)
goto err;
handle = max << 16 | min;