cilium / ebpf

ebpf-go is a pure-Go library to read, modify and load eBPF programs and attach them to various hooks in the Linux kernel.

Home Page:https://ebpf-go.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kconfig: validate that PutInteger doesn't truncate data

lmb opened this issue · comments

In #1202 I exported PutInteger from the kconfig package. The function has basic validation for booleans, but doesn't check that the value isn't truncated when writing into an integer. We should add bounds checking to make sure we don't write a large value like 0xffff into a uint8 for example. Note that this needs to take the signedness of the target integer into account.

  • Validate that n doesn't exceed the bounds of the 1,2 4, 8 byte integer we are writing into.
  • Add testcases for PutInteger

may I handle this issue? I'll create issue soon!

@atgane how are you getting on? Feel free to drop into the ebpf-go-dev channel on Slack if you want to discuss this.

I'm working on a test case, and I will make PR this week!

@atgane Ping to check if you're still working on this.

The PR was closed by mistake, is there any more work to be done since the last commit?

By PR, do you mean #1277? If you want it to be merged, it needs to be reopened, rebased and squashed, and the merge commit removed. :)

Thank you for your reply. I'll create a PR again