-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
af_alg_iv::as_slice makes a slice of the struct data, but the fields are public. #1501
Comments
This is a read/write buffer overflow, which is most likely an exploitable security vulnerability. Please prioritize fixing this. |
@gnzlbg the Removing it, means the type But removing it is also a breaking change. It isn't used internally by |
Alternatively you could make the fields private and create |
@Shnatsel libc crate intent is to export the exact binding of struct definition "as it". I think it would be against RFC1291 to make fields private and functions to modify them. |
@semarie this type is borked. It should be a dynamically-sized type (e.g. using Then its fields are public, but should be private, because how to actually emulate dynamically sized types is an implementation detail (e.g. ideally we would just make this a type alias to So I'd be fine with:
This is the PR that added it #1261 and this PR added it to nix nix-rust/nix#1031 (cc @glebpom , cc @asomers ). What do you think ? Do you know of any users / crates depending on this type that we should try to coordinate a fix with ? Everything is recent enough that we might be able to land a fix without much ecosystem disruption beyond maybe releasing a patch version of nix releases since ~april.
While this isn't good, to actually trigger this one has to:
If you know a crate with a vulnerability related to this, it would be good to know, but it feels like a long shot. Any API dealing with this type is going to give you a |
|
This issue should receive more attention. Enabling the println!("{:?}", Box::new(libc::af_alg_iv { ivlen: 10000000, iv: [] })); |
Add deprecation notice to `af_alg_iv::as_slice` and trait implementations that depend on it These trait implementations exposed an unsound API (see #1501).
See rust-lang/libc#1501 in which this type's trait implementations are being removed; the change is being announced via this deprecation.
Let's remove this for 1.0, we are looking to get rid of the extra traits anyway. |
af_alg_iv::as_slice makes a slice, but the fields are public and it's a public type, so you could construct a value, set the length to be some invalid value, and then call
as_slice
to make a slice with an improper length, pointing into invalid memory.The text was updated successfully, but these errors were encountered: