diff options
author | Tim Gardner <tim.gardner@canonical.com> | 2010-02-23 08:55:21 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-15 12:06:40 -0400 |
commit | 437ccbe9b5cb9c2df272c6ff7a55ef494c2d0d67 (patch) | |
tree | c30796ad5a8d4c5a3fac08184953c9f17b96806f | |
parent | 70702844e7be631ea810e752c2f089792b3364bc (diff) |
netfilter: xt_recent: fix buffer overflow
commit 2c08522e5d2f0af2d6f05be558946dcbf8173683 upstream.
e->index overflows e->stamps[] every ip_pkt_list_tot packets.
Consider the case when ip_pkt_list_tot==1; the first packet received is stored
in e->stamps[0] and e->index is initialized to 1. The next received packet
timestamp is then stored at e->stamps[1] in recent_entry_update(),
a buffer overflow because the maximum e->stamps[] index is 0.
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | net/netfilter/xt_recent.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index fc70a49c0afd..1bb0d6c8438c 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c | |||
@@ -173,10 +173,10 @@ recent_entry_init(struct recent_table *t, const union nf_inet_addr *addr, | |||
173 | 173 | ||
174 | static void recent_entry_update(struct recent_table *t, struct recent_entry *e) | 174 | static void recent_entry_update(struct recent_table *t, struct recent_entry *e) |
175 | { | 175 | { |
176 | e->index %= ip_pkt_list_tot; | ||
176 | e->stamps[e->index++] = jiffies; | 177 | e->stamps[e->index++] = jiffies; |
177 | if (e->index > e->nstamps) | 178 | if (e->index > e->nstamps) |
178 | e->nstamps = e->index; | 179 | e->nstamps = e->index; |
179 | e->index %= ip_pkt_list_tot; | ||
180 | list_move_tail(&e->lru_list, &t->lru_list); | 180 | list_move_tail(&e->lru_list, &t->lru_list); |
181 | } | 181 | } |
182 | 182 | ||