diff options
| author | Mason Reed <mason@vector35.com> | 2025-06-28 18:40:23 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-07-02 01:56:54 -0400 |
| commit | b6e1dd2ef1400f8a9cdffd72f26262a0de64cbc8 (patch) | |
| tree | aba70402eb23dcc37b88248e3fa7b86509407b50 /rust | |
| parent | 340744d3f0156cb8fa5eacb463a57247bfc1cd84 (diff) | |
[Rust] Fix load options string not being terminated
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/lib.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 05c01077..3194ae14 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -194,7 +194,11 @@ where { let file_path = file_path.as_ref().to_cstr(); let options_or_default = if let Some(opt) = options { - opt.get_json_string().ok()?.to_cstr().to_bytes().to_vec() + opt.get_json_string() + .ok()? + .to_cstr() + .to_bytes_with_nul() + .to_vec() } else { Metadata::new_of_type(MetadataType::KeyValueDataType) .get_json_string() @@ -242,7 +246,11 @@ where P: ProgressCallback, { let options_or_default = if let Some(opt) = options { - opt.get_json_string().ok()?.to_cstr().to_bytes().to_vec() + opt.get_json_string() + .ok()? + .to_cstr() + .to_bytes_with_nul() + .to_vec() } else { Metadata::new_of_type(MetadataType::KeyValueDataType) .get_json_string() |
