Skip to content

Commit

Permalink
fruity: Fix USB mode parsing on iOS < 16
Browse files Browse the repository at this point in the history
Where the mode is a 3 byte blob.

Co-authored-by: Håvard Sørbø <havard@hsorbo.no>
  • Loading branch information
oleavr and hsorbo committed Oct 10, 2024
1 parent 2698d7d commit dcdfcf5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/fruity/usb.vala
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ namespace Frida.Fruity {
}

private static string parse_mode (Bytes mode) throws Error {
if (mode.get_size () != 4)
throw new Error.PROTOCOL ("Invalid mode response");
unowned uint8[] m = mode.get_data ();
return "%u:%u:%u:%u".printf (m[0], m[1], m[2], m[3]);
var result = new StringBuilder.sized (7);
foreach (uint8 byte in mode.get_data ()) {
if (result.len != 0)
result.append_c (':');
result.append_printf ("%u", byte);
}
return result.str;
}

private static string udid_from_serial_number (string serial) {
Expand Down

0 comments on commit dcdfcf5

Please sign in to comment.