hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/net/netfilter/xt_u32.c
....@@ -96,11 +96,32 @@
9696 return ret ^ data->invert;
9797 }
9898
99
+static int u32_mt_checkentry(const struct xt_mtchk_param *par)
100
+{
101
+ const struct xt_u32 *data = par->matchinfo;
102
+ const struct xt_u32_test *ct;
103
+ unsigned int i;
104
+
105
+ if (data->ntests > ARRAY_SIZE(data->tests))
106
+ return -EINVAL;
107
+
108
+ for (i = 0; i < data->ntests; ++i) {
109
+ ct = &data->tests[i];
110
+
111
+ if (ct->nnums > ARRAY_SIZE(ct->location) ||
112
+ ct->nvalues > ARRAY_SIZE(ct->value))
113
+ return -EINVAL;
114
+ }
115
+
116
+ return 0;
117
+}
118
+
99119 static struct xt_match xt_u32_mt_reg __read_mostly = {
100120 .name = "u32",
101121 .revision = 0,
102122 .family = NFPROTO_UNSPEC,
103123 .match = u32_mt,
124
+ .checkentry = u32_mt_checkentry,
104125 .matchsize = sizeof(struct xt_u32),
105126 .me = THIS_MODULE,
106127 };