summaryrefslogtreecommitdiff
path: root/rust/src/string.rs
diff options
context:
space:
mode:
authorMichael Krasnitski <michael.krasnitski@gmail.com>2025-01-28 12:24:06 -0500
committermason <35282038+emesare@users.noreply.github.com>2025-01-28 12:44:06 -0500
commit7fc1623f3bd90663e84bab236b8052dbd4901b54 (patch)
tree035c5a06482d20968c51b7685e58ff6c13f54e11 /rust/src/string.rs
parentb3f2ef82dd8fdc20887c09532c328356cf3552b6 (diff)
Fix `BnStrCompatible` impl for `&Path`
Diffstat (limited to 'rust/src/string.rs')
-rw-r--r--rust/src/string.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/rust/src/string.rs b/rust/src/string.rs
index dde8f550..f3b00c95 100644
--- a/rust/src/string.rs
+++ b/rust/src/string.rs
@@ -277,7 +277,9 @@ unsafe impl BnStrCompatible for &Path {
type Result = Vec<u8>;
fn into_bytes_with_nul(self) -> Self::Result {
- self.as_os_str().as_encoded_bytes().to_vec()
+ let ret = CString::new(self.as_os_str().as_encoded_bytes())
+ .expect("can't pass paths with internal nul bytes to core!");
+ ret.into_bytes_with_nul()
}
}