-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check bound before reading past socket buffer. #2271
base: master
Are you sure you want to change the base?
Check bound before reading past socket buffer. #2271
Conversation
Welcome @shane-lawrence! It looks like this is your first PR to falcosecurity/libs 🎉 |
Thanks for this contribution; it makes sense to me. |
Perf diff from master - unit tests
Heap diff from master - unit tests
Heap diff from master - scap file
Benchmarks diff from master
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2271 +/- ##
=======================================
Coverage 75.29% 75.29%
=======================================
Files 279 279
Lines 34389 34389
Branches 5878 5878
=======================================
Hits 25893 25893
Misses 8496 8496
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
dd4443c
to
1f409df
Compare
I added tests and confirmed that it triggers a segfault without the fix but succeeds with the fix. |
Signed-off-by: Shane Lawrence <[email protected]>
Signed-off-by: Shane Lawrence <[email protected]>
1f409df
to
e0878bf
Compare
Just rebased on master to pick up the API changes @ekoops made recently. |
Hey @shane-lawrence Thank you for this PR! Just noticed 👇 May you fix the code formatting, please? |
Signed-off-by: Shane Lawrence <[email protected]>
Signed-off-by: Shane Lawrence <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Catch! Thank you!
LGTM label has been added. Git tree hash: 431f76b8d8276d05cd2821e4cd7cc62d0faf0a32
|
I'm restarting the CI, if it passes it's good for me |
Signed-off-by: Shane Lawrence <[email protected]>
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shane-lawrence The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Shane Lawrence <[email protected]>
Signed-off-by: Shane Lawrence <[email protected]>
Signed-off-by: Shane Lawrence [email protected]
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area libscap
Does this PR require a change in the driver versions?
I don't think so.
What this PR does / why we need it:
This PR corrects a bug in libscap where the next character in a buffer is read before checking if it's out of bounds. This can cause a segfault when the 1 MB buffer ends with a TIME_WAIT socket.
Which issue(s) this PR fixes:
Fixes #2272.
Special notes for your reviewer:
I had trouble getting the C++ test suite to work with the older C code in scap_fds.c, so I put them in separate files. Please let me know if there's a better way to handle it.
Does this PR introduce a user-facing change?:
no