std: Cap read/write limits on Windows networking#31858
Merged
bors merged 1 commit intorust-lang:masterfrom Feb 26, 2016
Merged
Conversation
Member
Author
|
cc @ollie27 |
Contributor
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
src/libstd/sys/windows/net.rs
Outdated
Contributor
There was a problem hiding this comment.
This is missing an as usize.
May as well make this line match the others:
let len = cmp::min(buf.len(), <wrlen_t>::max_value() as usize) as wrlen_t;
Member
Author
There was a problem hiding this comment.
oh oops good catch! I also figured it's better to use i32 here as it's what's actually required for the system call (eg this is windows specific).
I'm not a huge fan of the usage of wrlen_t in general unfortunately...
3 tasks
Similar to rust-lang#31825 where the read/write limits were capped for files, this implements similar limits when reading/writing networking types. On Unix this shouldn't affect anything because the write size is already a `usize`, but on Windows this will cap the read/write amounts to `i32::max_value`. cc rust-lang#31841
8bccee6 to
f3be73c
Compare
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit f3be73c has been approved by |
Collaborator
bors
added a commit
that referenced
this pull request
Feb 26, 2016
Similar to #31825 where the read/write limits were capped for files, this implements similar limits when reading/writing networking types. On Unix this shouldn't affect anything because the write size is already a `usize`, but on Windows this will cap the read/write amounts to `i32::max_value`. cc #31841
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to #31825 where the read/write limits were capped for files, this
implements similar limits when reading/writing networking types. On Unix this
shouldn't affect anything because the write size is already a
usize, but onWindows this will cap the read/write amounts to
i32::max_value.cc #31841