diff options
Diffstat (limited to 'package/network/utils/nftables/patches/202-datatype-use-mpz_set_str-instead-of-gmp_sscanf.patch')
-rw-r--r-- | package/network/utils/nftables/patches/202-datatype-use-mpz_set_str-instead-of-gmp_sscanf.patch | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/package/network/utils/nftables/patches/202-datatype-use-mpz_set_str-instead-of-gmp_sscanf.patch b/package/network/utils/nftables/patches/202-datatype-use-mpz_set_str-instead-of-gmp_sscanf.patch new file mode 100644 index 0000000000..4b22ec26e5 --- /dev/null +++ b/package/network/utils/nftables/patches/202-datatype-use-mpz_set_str-instead-of-gmp_sscanf.patch @@ -0,0 +1,28 @@ +From 23e8958a5e539f682be4cbdf5196aa2014c7e295 Mon Sep 17 00:00:00 2001 +From: Steven Barth <cyrus@openwrt.org> +Date: Mon, 15 Dec 2014 14:09:27 +0100 +Subject: [PATCH 2/5] datatype: use mpz_set_str instead of gmp_sscanf + +This simplifies the integer parsing logic and restricts it to +functions being part of the mini-gmp subset. + +Signed-off-by: Steven Barth <cyrus@openwrt.org> +--- + src/datatype.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/src/datatype.c ++++ b/src/datatype.c +@@ -275,11 +275,9 @@ static struct error_record *integer_type + struct expr **res) + { + mpz_t v; +- int len; + + mpz_init(v); +- if (gmp_sscanf(sym->identifier, "%Zu%n", v, &len) != 1 || +- (int)strlen(sym->identifier) != len) { ++ if (mpz_set_str(v, sym->identifier, 0)) { + mpz_clear(v); + return error(&sym->location, "Could not parse %s", + sym->dtype->desc); |