Permalink
Browse files

Fix overflow in adb_client

Change-Id: I7f8582bd8a69d61ce47d11a9ffd0e901fc371037
Credit: Joshua Drake
Bug: 12060953
  • Loading branch information...
1 parent 5dc5bfe commit e89e09dd2b9b42184973e3ade291186a2737bced @nickkral nickkral committed Dec 10, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 adb/adb_client.c
View
@@ -228,7 +228,7 @@ int adb_connect(const char *service)
} else {
// if server was running, check its version to make sure it is not out of date
char buf[100];
- int n;
+ size_t n;
int version = ADB_SERVER_VERSION - 1;
// if we have a file descriptor, then parse version result
@@ -237,7 +237,7 @@ int adb_connect(const char *service)
buf[4] = 0;
n = strtoul(buf, 0, 16);
- if(n > (int)sizeof(buf)) goto error;
+ if(n > sizeof(buf)) goto error;
if(readx(fd, buf, n)) goto error;
adb_close(fd);

0 comments on commit e89e09d

Please sign in to comment.