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.
BnStrCompatible
&Path
1 parent b3f2ef8 commit e8bbb62Copy full SHA for e8bbb62
rust/src/string.rs
@@ -277,7 +277,9 @@ unsafe impl BnStrCompatible for &Path {
277
type Result = Vec<u8>;
278
279
fn into_bytes_with_nul(self) -> Self::Result {
280
- self.as_os_str().as_encoded_bytes().to_vec()
+ let ret = CString::new(self.as_os_str().as_encoded_bytes())
281
+ .expect("can't pass paths with internal nul bytes to core!");
282
+ ret.into_bytes_with_nul()
283
}
284
285
0 commit comments