浏览代码

netfilter: xt_recent: fix false match

A rule with a zero hit_count will always match.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Cc: stable@kernel.org
Signed-off-by: Patrick McHardy <kaber@trash.net>
Tim Gardner 15 年之前
父节点
当前提交
8ccb92ad41
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/netfilter/xt_recent.c

+ 1 - 1
net/netfilter/xt_recent.c

@@ -267,7 +267,7 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par)
 		for (i = 0; i < e->nstamps; i++) {
 		for (i = 0; i < e->nstamps; i++) {
 			if (info->seconds && time_after(time, e->stamps[i]))
 			if (info->seconds && time_after(time, e->stamps[i]))
 				continue;
 				continue;
-			if (++hits >= info->hit_count) {
+			if (info->hit_count && ++hits >= info->hit_count) {
 				ret = !ret;
 				ret = !ret;
 				break;
 				break;
 			}
 			}