From e7b4077aca9444145394852900ac109f5a876d4a Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Wed, 13 Sep 2023 14:04:37 -0400 Subject: fix the rust API get_form_input bug --- rust/src/interaction.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'rust/src') 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 { 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 { + 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 -- cgit v1.3.1