mirror of
https://github.com/zed-industries/zed.git
synced 2026-07-09 16:00:35 +00:00
Narrow an unsafe block
This commit is contained in:
parent
469e14eccd
commit
85afc7d9af
1 changed files with 4 additions and 4 deletions
|
|
@ -800,13 +800,13 @@ impl Platform for WindowsPlatform {
|
|||
match NonNull::new(credentials) {
|
||||
Some(credentials) => {
|
||||
let username = unsafe { credentials.as_ref().UserName.to_string() };
|
||||
let password: Result<Vec<u8>> = unsafe {
|
||||
let password: Result<Vec<u8>> = {
|
||||
let size = credentials.as_ref().CredentialBlobSize as usize;
|
||||
match NonNull::new(credentials.as_ref().CredentialBlob) {
|
||||
Some(credential_blob) => {
|
||||
Ok(std::slice::from_raw_parts(credential_blob.as_ptr(), size)
|
||||
.to_vec())
|
||||
Some(credential_blob) => Ok(unsafe {
|
||||
std::slice::from_raw_parts(credential_blob.as_ptr(), size)
|
||||
}
|
||||
.to_vec()),
|
||||
None if size == 0 => Ok(Vec::new()),
|
||||
None => Err(anyhow!(
|
||||
"Windows credential blob was null with nonzero size"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue