diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp index b3fce54fa..d5ea6db68 100644 --- a/fastboot/device/commands.cpp +++ b/fastboot/device/commands.cpp @@ -176,7 +176,7 @@ bool DownloadHandler(FastbootDevice* device, const std::vector& arg // arg[0] is the command name, arg[1] contains size of data to be downloaded unsigned int size; - if (!android::base::ParseUint("0x" + args[1], &size, UINT_MAX)) { + if (!android::base::ParseUint("0x" + args[1], &size, kMaxDownloadSizeDefault)) { return device->WriteStatus(FastbootResult::FAIL, "Invalid size"); } device->download_data().resize(size); diff --git a/fastboot/device/commands.h b/fastboot/device/commands.h index 9df43a90c..bb1f988c3 100644 --- a/fastboot/device/commands.h +++ b/fastboot/device/commands.h @@ -19,6 +19,8 @@ #include #include +constexpr unsigned int kMaxDownloadSizeDefault = 0x20000000; + class FastbootDevice; enum class FastbootResult { diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp index 2de79b18d..630e22d88 100644 --- a/fastboot/device/variables.cpp +++ b/fastboot/device/variables.cpp @@ -36,7 +36,6 @@ using ::android::hardware::fastboot::V1_0::FileSystemType; using ::android::hardware::fastboot::V1_0::Result; using ::android::hardware::fastboot::V1_0::Status; -constexpr int kMaxDownloadSizeDefault = 0x20000000; constexpr char kFastbootProtocolVersion[] = "0.4"; bool GetVersion(FastbootDevice* /* device */, const std::vector& /* args */,