]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: x_tables: avoid stack-out-of-bounds read in xt_copy_counters_from_user
authorEric Dumazet <edumazet@google.com>
Thu, 5 Oct 2017 09:50:07 +0000 (02:50 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 6 Oct 2017 13:04:05 +0000 (15:04 +0200)
commit651a91575b5cbe3fb5a97f19cbe46227ec4a7436
treed89583ebd5b7d23418dbc0d44472f60eecd66ccd
parentdf648e45c7bb0a5fc66f0d2d9b50d54e398822ec
netfilter: x_tables: avoid stack-out-of-bounds read in xt_copy_counters_from_user

syzkaller reports an out of bound read in strlcpy(), triggered
by xt_copy_counters_from_user()

Fix this by using memcpy(), then forcing a zero byte at the last position
of the destination, as Florian did for the non COMPAT code.

Fixes: 6aedb1a1ff24 ("netfilter: x_tables: introduce and use xt_copy_counters_from_user")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/x_tables.c