Skip to content

Commit

Permalink
Fix the return value of bpf_strstr_tp_loop when it does not meet the …
Browse files Browse the repository at this point in the history
…valid range (#1294)
  • Loading branch information
tsint authored Oct 31, 2024
1 parent d3b2240 commit 56e5b9b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bpf/trace_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ static __always_inline unsigned char *bpf_strstr_tp_loop(unsigned char *buf, int
bpf_loop(nr_loops, tp_match, &data, 0);

if (data.pos) {
u32 pos = (data.pos > (TRACE_BUF_SIZE - TRACE_PARENT_HEADER_LEN)) ? 0 : data.pos;
return &(buf[pos]);
return (data.pos > (TRACE_BUF_SIZE - TRACE_PARENT_HEADER_LEN)) ? 0 : &(buf[data.pos]);
}

return 0;
Expand Down

0 comments on commit 56e5b9b

Please sign in to comment.