Skip to content

Commit 51e05a8

Browse files
bitcoffeeiuxanakryiko
authored andcommitted
libbpf: Fix overrun in netlink attribute iteration
I accidentally found that a change in commit 1045b03 ("netlink: fix overrun in attribute iteration") was not synchronized to the function `nla_ok` in tools/lib/bpf/nlattr.c, I think it is necessary to modify, this patch will do it. Signed-off-by: Xin Liu <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 2efcf69 commit 51e05a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/nlattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
3232

3333
static int nla_ok(const struct nlattr *nla, int remaining)
3434
{
35-
return remaining >= sizeof(*nla) &&
35+
return remaining >= (int)sizeof(*nla) &&
3636
nla->nla_len >= sizeof(*nla) &&
3737
nla->nla_len <= remaining;
3838
}

0 commit comments

Comments
 (0)