From 2457ac45f6f1c4196e950bcf05434d3be0727583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Mon, 28 Oct 2024 14:51:18 +0100 Subject: [PATCH] fruity: Fix edge-case in tunnel logic for older OS versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When usbmuxd is not available, we would try to set up a tunnel connection. This would then fail when the OS is too old for CoreDevice support, and we would erroneously cache the Tunnel implementation in its unopened state. This meant it could be used as if it was opened, causing undefined behavior. Co-authored-by: Håvard Sørbø --- src/fruity/device-monitor.vala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fruity/device-monitor.vala b/src/fruity/device-monitor.vala index 9b89429c1..3bf9264bc 100644 --- a/src/fruity/device-monitor.vala +++ b/src/fruity/device-monitor.vala @@ -1174,7 +1174,7 @@ namespace Frida.Fruity { private Promise? device_request; private Promise? modeswitch_request; - private Promise? tunnel_request; + private Promise? tunnel_request; private NcmPeer? ncm_peer; public PortableCoreDeviceUsbTransport (PortableCoreDeviceBackend parent, LibUSB.Device raw_device, string udid, @@ -1318,7 +1318,9 @@ namespace Frida.Fruity { try { yield tunnel.open (cancellable); } catch (Error e) { - if (!(e is Error.NOT_SUPPORTED)) + if (e is Error.NOT_SUPPORTED) + tunnel = null; + else throw e; } }