am c8cc8ea2: am 5abd3d0b: Merge "adbd: tcpip command uses port number from uninitialized memory"
* commit 'c8cc8ea221977f0a0a9ec86d1473605a61fa2a92':
adbd: tcpip command uses port number from uninitialized memory
diff --git a/adb/services.c b/adb/services.c
index d5a4642..e4ce0bc 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -455,7 +455,7 @@
ret = create_subproc_thread("/system/bin/bu restore", SUBPROC_RAW);
} else if(!strncmp(name, "tcpip:", 6)) {
int port;
- if (sscanf(name + 6, "%d", &port) == 0) {
+ if (sscanf(name + 6, "%d", &port) != 1) {
port = 0;
}
ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port);
@@ -527,7 +527,7 @@
}
// zero terminate the host at the point we found the colon
hostbuf[portstr - host] = 0;
- if (sscanf(portstr + 1, "%d", &port) == 0) {
+ if (sscanf(portstr + 1, "%d", &port) != 1) {
snprintf(buffer, buffer_size, "bad port number %s", portstr);
return;
}