From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft] meta: fix error checks in tc handle parser
Date: Mon, 1 Feb 2016 12:02:36 +0100 [thread overview]
Message-ID: <1454324556-29019-1-git-send-email-fw@strlen.de> (raw)
'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>
---
src/meta.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/meta.c b/src/meta.c
index 8cbc974..7f12f0c 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", &min, &max) != 2)
goto err;
handle = max << 16 | min;
--
2.4.10
next reply other threads:[~2016-02-01 11:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 11:02 Florian Westphal [this message]
2016-02-01 17:53 ` [PATCH nft] meta: fix error checks in tc handle parser Pablo Neira Ayuso
2016-02-01 20:02 ` Florian Westphal
2016-02-16 18:25 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454324556-29019-1-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).