Skip to content

Commit

Permalink
fix(c): check against NULL before memcpy
Browse files Browse the repository at this point in the history
  • Loading branch information
geyslan committed Aug 9, 2023
1 parent 817b697 commit c5dfa35
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libbpfgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ void libbpfgo_bpf_map__initial_value(struct bpf_map *map, void *value)
{
size_t psize;
const void *data;

data = bpf_map__initial_value(map, &psize);
if (!data)
return;

memcpy(value, data, psize);
}

Expand Down

0 comments on commit c5dfa35

Please sign in to comment.