netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft] meta: fix error checks in tc handle parser
@ 2016-02-01 11:02 Florian Westphal
  2016-02-01 17:53 ` Pablo Neira Ayuso
  2016-02-16 18:25 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Westphal @ 2016-02-01 11:02 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

'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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-16 18:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-01 11:02 [PATCH nft] meta: fix error checks in tc handle parser Florian Westphal
2016-02-01 17:53 ` Pablo Neira Ayuso
2016-02-01 20:02   ` Florian Westphal
2016-02-16 18:25 ` Pablo Neira Ayuso

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).