diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2023-09-13 14:04:37 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2023-09-19 21:16:41 -0400 |
| commit | e7b4077aca9444145394852900ac109f5a876d4a (patch) | |
| tree | 50bfec40f34092f6c13407676930ce93d2418fca /rust/src | |
| parent | b1e5ac87b14610a577292a85319047426ff47a8e (diff) | |
fix the rust API get_form_input bug
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/interaction.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/rust/src/interaction.rs b/rust/src/interaction.rs index 20f84348..557dfdf3 100644 --- a/rust/src/interaction.rs +++ b/rust/src/interaction.rs @@ -22,7 +22,7 @@ use std::path::PathBuf; use crate::binaryview::BinaryView; use crate::rc::Ref; -use crate::string::{BnStr, BnString}; +use crate::string::{BnStr, BnString, BnStrCompatible}; pub fn get_text_line_input(prompt: &str, title: &str) -> Option<String> { let prompt = CString::new(prompt).unwrap(); @@ -467,11 +467,12 @@ impl FormInputBuilder { /// println!("{} {} likes {}", &first_name, &last_name, food); /// ``` pub fn get_form_input(&mut self, title: &str) -> Vec<FormResponses> { + let safe_title = title.into_bytes_with_nul(); if unsafe { BNGetFormInput( self.fields.as_mut_ptr(), self.fields.len(), - title.as_ptr() as *const _, + safe_title.as_ptr() as *const _, ) } { let result = self |
