Skip to content

Commit 26caf7f

Browse files
committed
netfilter: xt_nfacct: don't assume acct name is null-terminated
JIRA: https://issues.redhat.com/browse/RHEL-115630 Upstream Status: commit bf58e66 commit bf58e66 Author: Florian Westphal <fw@strlen.de> Date: Fri Jul 18 13:27:13 2025 +0200 netfilter: xt_nfacct: don't assume acct name is null-terminated BUG: KASAN: slab-out-of-bounds in .. lib/vsprintf.c:721 Read of size 1 at addr ffff88801eac95c8 by task syz-executor183/5851 [..] string+0x231/0x2b0 lib/vsprintf.c:721 vsnprintf+0x739/0xf00 lib/vsprintf.c:2874 [..] nfacct_mt_checkentry+0xd2/0xe0 net/netfilter/xt_nfacct.c:41 xt_check_match+0x3d1/0xab0 net/netfilter/x_tables.c:523 nfnl_acct_find_get() handles non-null input, but the error printk relied on its presence. Reported-by: syzbot+4ff165b9251e4d295690@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=4ff165b9251e4d295690 Tested-by: syzbot+4ff165b9251e4d295690@syzkaller.appspotmail.com Fixes: ceb98d0 ("netfilter: xtables: add nfacct match to support extended accounting") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fwestpha@redhat.com>
1 parent c8d7d7d commit 26caf7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/netfilter/xt_nfacct.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ nfacct_mt_checkentry(const struct xt_mtchk_param *par)
3838

3939
nfacct = nfnl_acct_find_get(par->net, info->name);
4040
if (nfacct == NULL) {
41-
pr_info_ratelimited("accounting object `%s' does not exists\n",
42-
info->name);
41+
pr_info_ratelimited("accounting object `%.*s' does not exist\n",
42+
NFACCT_NAME_MAX, info->name);
4343
return -ENOENT;
4444
}
4545
info->nfacct = nfacct;

0 commit comments

Comments
 (0)