From a01896d95ed78d5e0bdf7ffab2a941aaa400d326 Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Fri, 26 Apr 2024 10:03:25 -0300 Subject: [PATCH] Fix binja_path in case the lib is a symlink --- rust/src/headless.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust/src/headless.rs b/rust/src/headless.rs index 1520fc589..e4024d8e3 100644 --- a/rust/src/headless.rs +++ b/rust/src/headless.rs @@ -59,6 +59,11 @@ fn binja_path() -> PathBuf { let path = CStr::from_ptr(info.dli_fname); let path = OsStr::from_bytes(path.to_bytes()); let mut path = PathBuf::from(path); + while path.is_symlink() { + path = path + .read_link() + .expect("Failed to find libbinaryninjacore path!"); + } path.pop(); path