Stop using adb_strtok, and check argument validity.
(cherry picked from commit ba45ddf37c
)
Change-Id: Iba4f77f7db54ca0184437bd8ea96abfadabc72a3
This commit is contained in:
parent
5c025ac5c8
commit
f7466f9f23
1 changed files with 9 additions and 8 deletions
|
@ -43,15 +43,16 @@ void* service_bootstrap_func(void* x) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sideload_host_service(int sfd, void* cookie) {
|
static void sideload_host_service(int sfd, void* data) {
|
||||||
char* saveptr;
|
const char* args = reinterpret_cast<const char*>(data);
|
||||||
const char* s = adb_strtok_r(reinterpret_cast<char*>(cookie), ":", &saveptr);
|
int file_size;
|
||||||
uint64_t file_size = strtoull(s, NULL, 10);
|
int block_size;
|
||||||
s = adb_strtok_r(NULL, ":", &saveptr);
|
if (sscanf(args, "%d:%d", &file_size, &block_size) != 2) {
|
||||||
uint32_t block_size = strtoul(s, NULL, 10);
|
printf("bad sideload-host arguments: %s\n", args);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
printf("sideload-host file size %" PRIu64 " block size %" PRIu32 "\n",
|
printf("sideload-host file size %d block size %d\n", file_size, block_size);
|
||||||
file_size, block_size);
|
|
||||||
|
|
||||||
int result = run_adb_fuse(sfd, file_size, block_size);
|
int result = run_adb_fuse(sfd, file_size, block_size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue