Skip to content
2 changes: 2 additions & 0 deletions internal/pkg/daemon/bpfrecorder/bpf/bpf_d_path_tetragon.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ prepend(char **buffer, int *buflen, const char *str, int namelen)
if (*buflen < 0) // will never happen - check function comment
return -ENAMETOOLONG;
*buffer -= namelen;
if (namelen <= 0 || namelen > MAX_BUF_LEN)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is call only with a fix length of 10. See

int error = prepend(buf, buflen, " (deleted)", 10);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is not strictly required since this function is not exposed at the moment, but is a good defence in depth for future use.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orbisai0security can you address code review comments?

return -ENAMETOOLONG;
memcpy(*buffer, str, namelen);
return 0;
}
Expand Down
Loading