mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
samples/bpf: Fix buffer overflow in tcp_basertt
Using sizeof(nv) or strlen(nv)+1 is correct.
Fixes: c890063e44
("bpf: sample BPF_SOCKET_OPS_BASE_RTT program")
Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
Link: https://lore.kernel.org/r/1683276658-2860-1-git-send-email-yangpc@wangsu.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
6953518629
commit
f4dea9689c
1 changed files with 1 additions and 1 deletions
|
@ -47,7 +47,7 @@ int bpf_basertt(struct bpf_sock_ops *skops)
|
|||
case BPF_SOCK_OPS_BASE_RTT:
|
||||
n = bpf_getsockopt(skops, SOL_TCP, TCP_CONGESTION,
|
||||
cong, sizeof(cong));
|
||||
if (!n && !__builtin_memcmp(cong, nv, sizeof(nv)+1)) {
|
||||
if (!n && !__builtin_memcmp(cong, nv, sizeof(nv))) {
|
||||
/* Set base_rtt to 80us */
|
||||
rv = 80;
|
||||
} else if (n) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue