Fix overflow in adb_client

Credit: Joshua Drake
Bug: 12060953

(cherry picked from commit e89e09dd2b)

Change-Id: I8a9b2592a5e4f7527c607abfe4ea6df6eb550aa8
This commit is contained in:
Nick Kralevich 2013-12-10 10:18:10 -08:00
parent 39baa8296d
commit 75e0645921
1 changed files with 2 additions and 2 deletions

View File

@ -241,7 +241,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
@ -250,7 +250,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);