On 10/28/16 15:36, Leif Lindholm wrote:
> On Fri, Oct 28, 2016 at 11:44:34AM +0100, Ard Biesheuvel wrote:
>> Get rid of calls to unsafe string functions. These are deprecated and may
>> be removed in the future.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ard Biesheuvel <[email protected]>
>> ---
>>  EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c     |  3 ++-
>>  EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 11 
>> ++++++-----
>>  2 files changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c 
>> b/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c
>> index bbca90fc08a2..f3e770bcc980 100644
>> --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c
>> +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c
>> @@ -84,7 +84,8 @@ ParseAndroidBootImg (
>>                   + ALIGN_VALUE (Header->KernelSize, Header->PageSize));
>>    }
>>  
>> -  AsciiStrnCpy (KernelArgs, Header->KernelArgs, BOOTIMG_KERNEL_ARGS_SIZE);
>> +  AsciiStrnCpyS (KernelArgs, BOOTIMG_KERNEL_ARGS_SIZE, Header->KernelArgs,
>> +    BOOTIMG_KERNEL_ARGS_SIZE);
>>  
>>    return EFI_SUCCESS;
>>  }
>> diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c 
>> b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c
>> index 9ddc34f57cf4..c5e8a7e34af2 100644
>> --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c
>> +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c
>> @@ -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);
> 
> I'll try to keep the bikeshedding to a minimum, but since
> mNumDataBytes is generated from NumBytesString in the first place, why
> not do
>   "DATA%s", NumBytesString
> ?

Because of "0000000000000000000000000000000000000000000000012".

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to