diff options
author | Florian Westphal <fw@strlen.de> | 2016-02-01 12:02:36 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2016-02-17 15:53:08 +0100 |
commit | a5229aba55d8622ef12377f0a59827a709338270 (patch) | |
tree | a73f89311d62637ec805828687b68da8741d0212 /src/meta.c | |
parent | 065c01a09fb8b3d0f90707541b63d7ee42079fca (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>
Diffstat (limited to 'src/meta.c')
-rw-r--r-- | src/meta.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; |