mirror of
https://bitbucket.org/padavan/rt-n56u.git
synced 2025-12-18 11:21:45 +08:00
netfilter: x_tables: make sure e->next_offset covers remaining blob size
commit 6e94e0cfb0887e4013b3b930fa6ab1fe6bb6ba91 upstream. Otherwise this function may read data beyond the ruleset blob. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
committed by
andy.padavan
parent
24256848ae
commit
355fbc0184
@@ -557,7 +557,8 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e,
|
||||
int err;
|
||||
|
||||
if ((unsigned long)e % __alignof__(struct arpt_entry) != 0 ||
|
||||
(unsigned char *)e + sizeof(struct arpt_entry) >= limit) {
|
||||
(unsigned char *)e + sizeof(struct arpt_entry) >= limit ||
|
||||
(unsigned char *)e + e->next_offset > limit) {
|
||||
duprintf("Bad offset %p\n", e);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1217,7 +1218,8 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,
|
||||
|
||||
duprintf("check_compat_entry_size_and_hooks %p\n", e);
|
||||
if ((unsigned long)e % __alignof__(struct compat_arpt_entry) != 0 ||
|
||||
(unsigned char *)e + sizeof(struct compat_arpt_entry) >= limit) {
|
||||
(unsigned char *)e + sizeof(struct compat_arpt_entry) >= limit ||
|
||||
(unsigned char *)e + e->next_offset > limit) {
|
||||
duprintf("Bad offset %p, limit = %p\n", e, limit);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -818,7 +818,8 @@ check_entry_size_and_hooks(struct ipt_entry *e,
|
||||
int err;
|
||||
|
||||
if ((unsigned long)e % __alignof__(struct ipt_entry) != 0 ||
|
||||
(unsigned char *)e + sizeof(struct ipt_entry) >= limit) {
|
||||
(unsigned char *)e + sizeof(struct ipt_entry) >= limit ||
|
||||
(unsigned char *)e + e->next_offset > limit) {
|
||||
duprintf("Bad offset %p\n", e);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1638,7 +1639,8 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e,
|
||||
|
||||
duprintf("check_compat_entry_size_and_hooks %p\n", e);
|
||||
if ((unsigned long)e % __alignof__(struct compat_ipt_entry) != 0 ||
|
||||
(unsigned char *)e + sizeof(struct compat_ipt_entry) >= limit) {
|
||||
(unsigned char *)e + sizeof(struct compat_ipt_entry) >= limit ||
|
||||
(unsigned char *)e + e->next_offset > limit) {
|
||||
duprintf("Bad offset %p, limit = %p\n", e, limit);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -731,7 +731,8 @@ check_entry_size_and_hooks(struct ip6t_entry *e,
|
||||
int err;
|
||||
|
||||
if ((unsigned long)e % __alignof__(struct ip6t_entry) != 0 ||
|
||||
(unsigned char *)e + sizeof(struct ip6t_entry) >= limit) {
|
||||
(unsigned char *)e + sizeof(struct ip6t_entry) >= limit ||
|
||||
(unsigned char *)e + e->next_offset > limit) {
|
||||
duprintf("Bad offset %p\n", e);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1495,7 +1496,8 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e,
|
||||
|
||||
duprintf("check_compat_entry_size_and_hooks %p\n", e);
|
||||
if ((unsigned long)e % __alignof__(struct compat_ip6t_entry) != 0 ||
|
||||
(unsigned char *)e + sizeof(struct compat_ip6t_entry) >= limit) {
|
||||
(unsigned char *)e + sizeof(struct compat_ip6t_entry) >= limit ||
|
||||
(unsigned char *)e + e->next_offset > limit) {
|
||||
duprintf("Bad offset %p, limit = %p\n", e, limit);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user