We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc6df1d commit 8ac04d1Copy full SHA for 8ac04d1
crates/credential/cargo-credential-wincred/src/main.rs
@@ -10,8 +10,14 @@ use winapi::um::winnt::LPWSTR;
10
11
struct WindowsCredential;
12
13
+/// Converts a string to a nul-terminated wide UTF-16 byte sequence.
14
fn wstr(s: &str) -> Vec<u16> {
- OsStr::new(s).encode_wide().chain(Some(0)).collect()
15
+ let mut wide: Vec<u16> = OsStr::new(s).encode_wide().collect();
16
+ if wide.iter().any(|b| *b == 0) {
17
+ panic!("nul byte in wide string");
18
+ }
19
+ wide.push(0);
20
+ wide
21
}
22
23
fn target_name(registry_name: &str) -> Vec<u16> {
0 commit comments