mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
netfilter: xt_recent: fix buffer overflow
commit 2c08522e5d 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
70702844e7
commit
437ccbe9b5
@@ -173,10 +173,10 @@ recent_entry_init(struct recent_table *t, const union nf_inet_addr *addr,
|
||||
|
||||
static void recent_entry_update(struct recent_table *t, struct recent_entry *e)
|
||||
{
|
||||
e->index %= ip_pkt_list_tot;
|
||||
e->stamps[e->index++] = jiffies;
|
||||
if (e->index > e->nstamps)
|
||||
e->nstamps = e->index;
|
||||
e->index %= ip_pkt_list_tot;
|
||||
list_move_tail(&e->lru_list, &t->lru_list);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user