Skip to content
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

Prevent potential buffer over-reads of file system representations #1124

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jmschonfeld
Copy link
Contributor

The CoreFoundation-level file system representation APIs allow for filling a provided buffer and returning a boolean value indicating success or failure. In some cases, we've seen clients partially filling a buffer, failing, and then reading the buffer despite the false return value. We can't avoid writing partial results to the buffer (as some clients depend on the partial results) but we can ensure that the buffer ends with a null terminator even in cases of failure. While the buffer may contain incorrect values, it will at least prevent simple buffer over-reads caused by immediate calls to functions like strlen on the return value.

…ntations that fail

Signed-off-by: Jeremy Schonfeld <jschonfeld@apple.com>
Signed-off-by: Jeremy Schonfeld <jschonfeld@apple.com>
Signed-off-by: Jeremy Schonfeld <jschonfeld@apple.com>
@jmschonfeld jmschonfeld requested a review from kperryua January 16, 2025 23:03
@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant