summaryrefslogtreecommitdiff
path: root/fastboot/fastboot.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-03-15 09:37:28 -0700
committerElliott Hughes <enh@google.com>2017-03-15 09:40:28 -0700
commit4a66730d6a0ec1da586c1ad2b2ce786c371ab4a8 (patch)
treec6c898d4746ffd073b56c543f267ed068c9697a5 /fastboot/fastboot.cpp
parent3d028f14c8a23c20e406f8f9d2c1ce7c8b54ad49 (diff)
Move "fastboot oem" to std::string.
Not sure how this code got missed when we moved everything else off C string handling... $ adb reboot bootloader $ fastboot oem `perl -e 'print "x"x1024;'` Before: <crashes> After: error: Command length (1028) exceeds maximum size (64) (The error says 1028 instead of 1024 because it includes the "oem ".) Bug: http://b/36232671 Test: fastboot oem `perl -e 'print "x"x1024;'` Change-Id: Ib4664e49222bd2b71be5aa3fe81f386d6073414f
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r--fastboot/fastboot.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index a4a0b5250..2927b16ca 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1245,20 +1245,17 @@ static int do_bypass_unlock_command(int argc, char **argv)
return 0;
}
-static int do_oem_command(int argc, char **argv)
-{
- char command[256];
+static int do_oem_command(int argc, char** argv) {
if (argc <= 1) return 0;
- command[0] = 0;
- while(1) {
- strcat(command,*argv);
+ std::string command;
+ while (argc > 0) {
+ command += *argv;
skip(1);
- if(argc == 0) break;
- strcat(command," ");
+ if (argc != 0) command += " ";
}
- fb_queue_command(command,"");
+ fb_queue_command(command.c_str(), "");
return 0;
}