From aed3e22a4fd7ef4ae7c249cfb9f71387df14ff73 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 10 Jan 2014 09:28:37 +0000 Subject: datatype: revert "fix crash if wrong integer type is passed" Revert commit a320531e7: We have generic type checks that handle this case just fine and indeed the bugzilla entry mentioned in the reverted patch states: BUG: invalid input descriptor type 538976288 nft: src/erec.c:100: erec_print: Assertion `0' failed. Abandon So the problem is not related to datatypes at all and generic type checking works perfectly fine: :1:52-57: Error: datatype mismatch, expected Ethernet protocol, expression has type Internet protocol add rule ip6 filter input position 4 meta protocol icmpv6 accept ~~~~~~~~~~~~~ ^^^^^^ Signed-off-by: Patrick McHardy --- src/datatype.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/datatype.c') diff --git a/src/datatype.c b/src/datatype.c index 2e5788dc..9910a1b3 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -230,10 +230,8 @@ static struct error_record *integer_type_parse(const struct expr *sym, if (gmp_sscanf(sym->identifier, "%Zu%n", v, &len) != 1 || (int)strlen(sym->identifier) != len) { mpz_clear(v); - if (sym->dtype != &integer_type) { - return error(&sym->location, "This is not a valid %s", - sym->dtype->desc); - } + if (sym->dtype != &integer_type) + return NULL; return error(&sym->location, "Could not parse %s", sym->dtype->desc); } -- cgit v1.2.3 From 4097ad726fce2398b42795d7b316d39fb8ea6ee5 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 10 Jan 2014 09:28:37 +0000 Subject: meta: fix crash when parsing unresolvable mark values *res has undefined contents, set to NULL before invoking the parse function to make sure the test for != NULL doesn't falsely return true. Signed-off-by: Patrick McHardy --- src/datatype.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/datatype.c') diff --git a/src/datatype.c b/src/datatype.c index 9910a1b3..86ea80e3 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -643,6 +643,7 @@ static struct error_record *mark_type_parse(const struct expr *sym, } } + *res = NULL; erec = sym->dtype->basetype->parse(sym, res); if (erec != NULL) return erec; -- cgit v1.2.3