X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmbeddedPkg%2FApplication%2FAndroidFastboot%2FAndroidFastbootApp.c;h=c5e8a7e34af2048151eeb826dd24c9225043ff54;hp=f380817040d00842b82d9d78a71f9f8838bd9f12;hb=310908760f5314c4a6d421ebcc6e1370bd2a1177;hpb=f6755908dee0d71926ec4f440edd384523746ef6 diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index f380817040..c5e8a7e34a 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c @@ -45,9 +45,9 @@ typedef enum { STATIC ANDROID_FASTBOOT_STATE mState = ExpectCmdState; // When in ExpectDataState, the number of bytes of data to expect: -STATIC UINT32 mNumDataBytes; +STATIC UINT64 mNumDataBytes; // .. and the number of bytes so far received this data phase -STATIC UINT32 mBytesReceivedSoFar; +STATIC UINT64 mBytesReceivedSoFar; // .. and the buffer to save data into STATIC UINT8 *mDataBuffer = NULL; @@ -99,7 +99,7 @@ HandleDownload ( IN CHAR8 *NumBytesString ) { - CHAR8 Response[12] = "DATA"; + CHAR8 Response[13]; CHAR16 OutputString[FASTBOOT_STRING_MAX_LENGTH]; // Argument is 8-character ASCII string hex representation of number of bytes @@ -127,8 +127,10 @@ HandleDownload ( if (mDataBuffer == NULL) { SEND_LITERAL ("FAILNot enough memory"); } else { - AsciiStrnCpy (Response + 4, NumBytesString, 8); - mTransport->Send (sizeof(Response), Response, &mFatalSendErrorEvent); + ZeroMem (Response, sizeof Response); + AsciiSPrint (Response, sizeof Response, "DATA%x", + (UINT32)mNumDataBytes); + mTransport->Send (sizeof Response - 1, Response, &mFatalSendErrorEvent); mState = ExpectDataState; mBytesReceivedSoFar = 0; @@ -257,8 +259,7 @@ AcceptCmd ( } // Commands aren't null-terminated. Let's get a null-terminated version. - AsciiStrnCpy (Command, Data, Size); - Command[Size] = '\0'; + AsciiStrnCpyS (Command, sizeof Command, Data, Size); // Parse command if (MATCH_CMD_LITERAL ("getvar", Command)) {