summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_statistic.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net </C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net>2007-07-03 12:52:55 +0000
committer/C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net </C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net>2007-07-03 12:52:55 +0000
commit1695f5dd5aef56cd9541af4b6336b29c7552435c (patch)
treeaf61ca34be1783a7a6992b4a51ec2cd90d134ed9 /extensions/libipt_statistic.c
parenta54381c95b2c5b56bd273336d05c565b433c6438 (diff)
[PATCH]: libipt_statistic: add a few missing validity checks
Signed-off-by: Nicolas Bouliane
Diffstat (limited to 'extensions/libipt_statistic.c')
-rw-r--r--extensions/libipt_statistic.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/extensions/libipt_statistic.c b/extensions/libipt_statistic.c
index 4ed1813..f8aad2a 100644
--- a/extensions/libipt_statistic.c
+++ b/extensions/libipt_statistic.c
@@ -113,6 +113,15 @@ final_check(unsigned int flags)
if (flags & 0x8 && info->mode != XT_STATISTIC_MODE_NTH)
exit_error(PARAMETER_PROBLEM,
"--packet can only be used in nth mode");
+ if ((flags & 0x8) && !(flags & 0x4))
+ exit_error(PARAMETER_PROBLEM,
+ "--packet can only be used with --every");
+ /* at this point, info->u.nth.every have been decreased. */
+ if (!(info->u.nth.packet >= 0 && info->u.nth.packet <= info->u.nth.every))
+ exit_error(PARAMETER_PROBLEM,
+ "the --packet p must be 0 <= p <= n-1");
+
+
info->u.nth.count = info->u.nth.every - info->u.nth.packet;
}