summaryrefslogtreecommitdiff
path: root/rust/src/headless.rs
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2023-09-20 14:40:22 -0400
committerKyleMiles <krm504@nyu.edu>2023-09-20 15:06:35 -0400
commit052a8d2adb0c7899ae875c03da4edf80b2fa1a81 (patch)
tree51fef92c717c7cc3af22446e97aed1bb1fd0bedb /rust/src/headless.rs
parentaf2e0455c082239b21bceffbaa1684f795cb1452 (diff)
Rust API : FFI Fix, was leaking some non-null-terminated strings to the core..fix passing a nullptr to `load`
Diffstat (limited to 'rust/src/headless.rs')
-rw-r--r--rust/src/headless.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/rust/src/headless.rs b/rust/src/headless.rs
index 0ce24cb3..c5e14eb0 100644
--- a/rust/src/headless.rs
+++ b/rust/src/headless.rs
@@ -12,8 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+use crate::string::BnStrCompatible;
+
use std::env;
-use std::ffi::CString;
use std::path::PathBuf;
#[cfg(not(target_os = "windows"))]
@@ -72,9 +73,9 @@ use binaryninjacore_sys::{BNInitPlugins, BNInitRepoPlugins, BNSetBundledPluginDi
pub fn init() {
unsafe {
let path = binja_path().join("plugins").into_os_string();
- let path = CString::new(path.into_string().unwrap()).unwrap();
+ let path = path.into_string().unwrap();
- BNSetBundledPluginDirectory(path.as_ptr());
+ BNSetBundledPluginDirectory(path.as_str().into_bytes_with_nul().as_ptr() as *mut _);
BNInitPlugins(true);
BNInitRepoPlugins();
}