yume-chan/ya-webadb

strange \x00 ends in reverse tunnel name

oott123 opened this issue · 2 comments

Issue Checklist

  • I'm using the library programmatically
  • For Scrcpy related issues, I have searched in Genymobile/scrcpy repository.

Library version

0.0.23

Environment

nodejs 20.14.0

Device

XiaoMi MI 5, Android 13 (lineage_gemini-userdebug 13 TQ3A.230901.001 0f600396c1)

Describe the bug

When using reverse tunnel, nothing happens when access the port forwarded on the device.

Steps to reproduce

  1. clone and run https://github.com/oott123/webadb-usb-reproduce
  2. try nc 127.0.0.1 8899 on the device
  3. see the bug

I have add a patch in the dispatcher:

diff --git a/esm/daemon/dispatcher.js b/esm/daemon/dispatcher.js
index 8bca8b8dc9b542e96cb529235a171fd5ca545ecf..417f7e797316d88d179368230ac9e7c3518768fe 100644
--- a/esm/daemon/dispatcher.js
+++ b/esm/daemon/dispatcher.js
@@ -170,6 +170,7 @@ export class AdbPacketDispatcher {
         }
         const handler = this.#incomingSocketHandlers.get(service);
         if (!handler) {
+            console.log(['incoming service', service]);
             await this.sendPacket(AdbCommand.Close, 0, remoteId);
             return;
         }

And when I access the reverse tunnel on the device, the following log appears in the terminal:

[ 'incoming service', 'localabstract:reverse_9404414318601646\x00' ]

As you can see, there are a strange "\x00" at the end of the tunnel service name.

This is the root cause of #628.

This is a regression caused by ac6dc1e#diff-8f0811eceb54fac2e33a4fb5e9fe839c02dd3c9ed1614ea08c45c0cff13348b9L196-L198

A new version will be released soon.

image

My publish token expired, and NPM is broken, so can't publish packages now...