diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2023-08-08 15:08:30 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2023-08-08 15:08:30 +0200 |
| commit | 651233d322e7c2e244b9256c0a2728e10c1fe0da (patch) | |
| tree | babb09cebf912f6d260bf66682c21144c1f7c2d4 | |
| parent | 1ac353b00318bc8ec8787c08120144255adb77de (diff) | |
| parent | 0f96f48db6e0cc914ca7ab56337bd510c11e932f (diff) | |
| download | mullvadvpn-651233d322e7c2e244b9256c0a2728e10c1fe0da.tar.xz mullvadvpn-651233d322e7c2e244b9256c0a2728e10c1fe0da.zip | |
Merge branch 'enable-even-more-safety-around-objective-c-runtime-calls-des-323'
| -rw-r--r-- | mullvad-daemon/Cargo.toml | 2 | ||||
| -rw-r--r-- | mullvad-daemon/src/macos_launch_daemon.rs | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml index 8270f1c474..ecc91e3306 100644 --- a/mullvad-daemon/Cargo.toml +++ b/mullvad-daemon/Cargo.toml @@ -55,7 +55,7 @@ simple-signal = "1.1" talpid-dbus = { path = "../talpid-dbus" } [target.'cfg(target_os="macos")'.dependencies] -objc = { version = "0.2.7", features = ["exception"] } +objc = { version = "0.2.7", features = ["exception", "verify_message"] } [target.'cfg(windows)'.dependencies] ctrlc = "3.0" diff --git a/mullvad-daemon/src/macos_launch_daemon.rs b/mullvad-daemon/src/macos_launch_daemon.rs index d71e4b49bb..3e10d94ce7 100644 --- a/mullvad-daemon/src/macos_launch_daemon.rs +++ b/mullvad-daemon/src/macos_launch_daemon.rs @@ -18,9 +18,18 @@ extern "C" {} #[repr(C)] #[derive(Debug)] struct NSOperatingSystemVersion { - major_version: libc::c_ulong, - minor_version: libc::c_ulong, - patch_version: libc::c_ulong, + major_version: libc::c_longlong, + minor_version: libc::c_longlong, + patch_version: libc::c_longlong, +} + +/// Implement Objective-C type encoding for the struct. Allows the `objc` crate +/// to perform function signature matching before performing calls into the Objective-C +/// runtime. This is needed to be able to enable the `verify_message` feature on `objc`. +unsafe impl objc::Encode for NSOperatingSystemVersion { + fn encode() -> objc::Encoding { + unsafe { objc::Encoding::from_str("{?=qqq}") } + } } /// Authorization status of the Mullvad daemon. |
