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

Remove unsafe and unnecessary size argument from FileDesc::read() #821

Merged
merged 1 commit into from
May 3, 2024

Commits on Sep 18, 2023

  1. Remove unsafe and unnecessary size argument from FileDesc::read()

    The `size` argument to `FileDesc::read()` is not checked against the
    length of the buffer, so `libc::read()` could end up writing past the
    buffer if we passed a size that's too large. However, we always pass
    exactly the size of the buffer, so that doesn't happen. Let's just
    remove the argument since it's not currently needed, thereby removing
    the risk of bugs if the function is used incorrectly by future
    callers.
    
    This came up in review of `unsafe` Rust code at my company.
    martinvonz committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    4fbdca1 View commit details
    Browse the repository at this point in the history