Skip to content

Commit

Permalink
Base64DecodeClover cannot return not-NULL and DecodedSize=0 anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
jief666 committed Sep 4, 2020
1 parent 0fd1dcb commit f4e10b1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rEFIt_UEFI/Platform/b64cdecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ long base64_decode_block(const char* code_in, const int length_in, char* plainte
/** UEFI interface to base54 decode.
* Decodes EncodedData into a new allocated buffer and returns it. Caller is responsible to FreePool() it.
* If DecodedSize != NULL, then size od decoded data is put there.
* If return value is not NULL, DecodedSize IS > 0
*/
UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, OUT UINTN *DecodedSize)
{
Expand All @@ -112,6 +113,11 @@ UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, OUT UINTN *DecodedSize)
base64_init_decodestate(&state_in);
DecodedSizeInternal = base64_decode_block(EncodedData, (const int)EncodedSize, (char*) DecodedData, &state_in);

if ( DecodedSizeInternal == 0 ) {
FreePool(DecodedData);
DecodedData = NULL;
}

if (DecodedSize != NULL) {
if ( DecodedSizeInternal < 0 ) panic("Base64DecodeClover : DecodedSizeInternal < 0");
*DecodedSize = (UINTN)DecodedSizeInternal;
Expand Down

0 comments on commit f4e10b1

Please sign in to comment.