summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2015-01-26 18:58:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-26 19:04:43 +0000
commit5abd3d0b79d4f4690058f9d70bf723ebaa99616e (patch)
tree1c960437b2a6ed7862e5f82312988ef921f23a78 /adb
parente21d7ae89e91a1f6797b74bf7f744b87eb6d2148 (diff)
parent943ef23b3de60c92a219e65aee35ae6242a461dc (diff)
downloadsystem_core-5abd3d0b79d4f4690058f9d70bf723ebaa99616e.zip
system_core-5abd3d0b79d4f4690058f9d70bf723ebaa99616e.tar.gz
system_core-5abd3d0b79d4f4690058f9d70bf723ebaa99616e.tar.bz2
Merge "adbd: tcpip command uses port number from uninitialized memory"
Diffstat (limited to 'adb')
-rw-r--r--adb/services.c4
1 files changed, 2 insertions, 2 deletions
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 @@ int service_to_fd(const char *name)
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 @@ static void connect_device(char* host, char* buffer, int buffer_size)
}
// 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;
}