From d3ee3a0c3c298aea8cce0f076882e546cce59b47 Mon Sep 17 00:00:00 2001 From: Changli Gao Date: Tue, 24 Mar 2009 13:27:01 +0800 Subject: [PATCH] libxt_fuzzy: need to account for kernel-level modified variables in .userspacesize When reviewing the code, I found there maybe a bug in libxt_fuzzy.c. If a user wants to delete this match, he will get an error reported, and the command fails. As the fields after maximum_rate in xt_fuzzy_mtinfo will be altered in kernel space, we should assign the userspacesize with the value offsetof(struct xt_fuzzy_mtinfo, packets_total) instead. --- doc/changelog.txt | 3 +++ extensions/libxt_fuzzy.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 18e74ee..a292c7d 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,5 +1,8 @@ +- fuzzy: need to account for kernel-level modified variables in .userspacesize + + Xtables-addons 1.13 (March 23 2009) =================================== - added a reworked ipv4options match diff --git a/extensions/libxt_fuzzy.c b/extensions/libxt_fuzzy.c index df55604..c2b96fe 100644 --- a/extensions/libxt_fuzzy.c +++ b/extensions/libxt_fuzzy.c @@ -9,6 +9,7 @@ */ #include #include +#include #include #include #include @@ -102,7 +103,7 @@ static struct xtables_match fuzzy_mt_reg = { .name = "fuzzy", .version = XTABLES_VERSION, .size = XT_ALIGN(sizeof(struct xt_fuzzy_mtinfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_fuzzy_mtinfo)), + .userspacesize = offsetof(struct xt_fuzzy_mtinfo, packets_total), .help = fuzzy_mt_help, .init = fuzzy_mt_init, .parse = fuzzy_mt_parse,