[PATCH nft] meta: fix error checks in tc handle parser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'meta priority foobar' did not return an error -- instead
we used min/max values with undefined content.

Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux