Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion adb_client/src/message_devices/adb_message_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,19 @@ impl<T: ADBMessageTransport> ADBMessageDevice<T> {
let mut rng = rand::rng();
let local_id: u32 = rng.random();

// adbd used to expect a null-terminated string.
// keep doing so to maintain compatibility with older versions.
// https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/adb/sockets.cpp;l=560?q=sockets.cpp
let mut destination = cmd.to_string().into_bytes();
if !destination.ends_with(&[0]) {
destination.push(0);
}

let message = ADBTransportMessage::try_new(
MessageCommand::Open,
local_id, // Our 'local-id'
0,
cmd.to_string().as_bytes(),
&destination,
)?;
self.transport.write_message(message)?;

Expand Down
Loading