-
Notifications
You must be signed in to change notification settings - Fork 377
Fix BOF #1851
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
Fix BOF #1851
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsure the UNIX domain socket path cannot overflow its buffer by validating its length before copying and exiting with an error on failure. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @Abdullah-Ebryx - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `contrib/seccomp-receiver/seccomp-receiver.c:52` </location>
<code_context>
-
+
+ if (strlen (path) >= sizeof (addr.sun_path))
+ error (EXIT_FAILURE, 0, "invalid path");
+
strcpy (addr.sun_path, path);
</code_context>
<issue_to_address>
The error message for an invalid path could be more descriptive.
Consider adding the invalid path or its length to the error message for better debugging context.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if (strlen (path) >= sizeof (addr.sun_path))
error (EXIT_FAILURE, 0, "invalid path");
=======
if (strlen (path) >= sizeof (addr.sun_path))
error (EXIT_FAILURE, 0, "invalid path: '%s' (length: %zu, max: %zu)", path, strlen(path), sizeof(addr.sun_path) - 1);
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
if (strlen (path) >= sizeof (addr.sun_path)) | ||
error (EXIT_FAILURE, 0, "invalid path"); |
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.
suggestion: The error message for an invalid path could be more descriptive.
Consider adding the invalid path or its length to the error message for better debugging context.
if (strlen (path) >= sizeof (addr.sun_path)) | |
error (EXIT_FAILURE, 0, "invalid path"); | |
if (strlen (path) >= sizeof (addr.sun_path)) | |
error (EXIT_FAILURE, 0, "invalid path: '%s' (length: %zu, max: %zu)", path, strlen(path), sizeof(addr.sun_path) - 1); |
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.
LGTM
Summary by Sourcery
Prevent buffer overflow when creating UNIX domain socket by validating the path length before copying into sun_path in seccomp-receiver.
Bug Fixes: