Rollup merge of #70479 - RalfJung:win-env, r=Mark-Simulacrum
avoid creating unnecessary reference in Windows Env iterator Discovered in https://github.com/rust-lang/miri/pull/1225: the Windows `Env` iterator violates Stacked Borrows by creating an `&u16`, turning it into a raw pointer, and then accessing memory outside the range of that type. There is no need to create a reference here in the first place, so the fix is trivial. Cc @JOE1994 Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/134
This commit is contained in:
commit
47ffca296a
1 changed files with 1 additions and 1 deletions
|
@ -94,7 +94,7 @@ impl Iterator for Env {
|
|||
if *self.cur == 0 {
|
||||
return None;
|
||||
}
|
||||
let p = &*self.cur as *const u16;
|
||||
let p = self.cur as *const u16;
|
||||
let mut len = 0;
|
||||
while *p.offset(len) != 0 {
|
||||
len += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue