[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_F9E2E81922B0C181D05B96DAE5AB0ACE6B06@qq.com>
Date: Tue, 22 Nov 2022 10:32:56 +0800
From: Rong Tao <rtoax@...mail.com>
To: ast@...nel.org
Cc: Rong Tao <rongtao@...tc.cn>,
Daniel Borkmann <daniel@...earbox.net>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
netdev@...r.kernel.org (open list:XDP (eXpress Data Path)),
bpf@...r.kernel.org (open list:XDP (eXpress Data Path)),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH bpf-next] samples/bpf: xdp_router_ipv4_user: Fix write overflow
From: Rong Tao <rongtao@...tc.cn>
prefix_key->data allocates three bytes using alloca(), but four bytes are
accessed in the program.
Signed-off-by: Rong Tao <rongtao@...tc.cn>
---
samples/bpf/xdp_router_ipv4_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index 683913bbf279..9d41db09c480 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -162,7 +162,7 @@ static void read_route(struct nlmsghdr *nh, int nll)
__be32 gw;
} *prefix_value;
- prefix_key = alloca(sizeof(*prefix_key) + 3);
+ prefix_key = alloca(sizeof(*prefix_key) + 4);
prefix_value = alloca(sizeof(*prefix_value));
prefix_key->prefixlen = 32;
--
2.38.1
Powered by blists - more mailing lists