diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-03-30 16:24:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-30 16:24:44 +0200 |
| commit | 47ffca296a533ee389fcea91de3f09827a7c9c49 (patch) | |
| tree | 3cf343394b6bce7b8d6d3423e444512337528ec4 /src/libstd/sys | |
| parent | a80ec3b3b1d11ed83754885efdd07037d256dbf2 (diff) | |
| parent | 2a1e61e2d653cd287ac902bdf3411d8cbbc40f0c (diff) | |
| download | rust-47ffca296a533ee389fcea91de3f09827a7c9c49.tar.gz rust-47ffca296a533ee389fcea91de3f09827a7c9c49.zip | |
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
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/windows/os.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index cc4ae405906..a0da2498bb7 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -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; |
