X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ShellPkg%2FLibrary%2FBaseFileHandleLib%2FBaseFileHandleLib.c;h=3200385ee58b0e63f23105b66ff8e0e1f0c12abb;hp=9136b9c20080b5dca78088beb64fb5ac1f519624;hb=727a4c7101e464b49aa7d3c8d6cc675e67b7118e;hpb=b82bfcc17f4ba0abf31640eb9f26d5e271f79cf1 diff --git a/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c b/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c index 9136b9c200..3200385ee5 100644 --- a/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c +++ b/ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.c @@ -668,6 +668,7 @@ StrnCatGrowLeft ( ){ UINTN DestinationStartSize; UINTN NewSize; + UINTN CopySize; // // ASSERTs @@ -714,7 +715,8 @@ StrnCatGrowLeft ( *Destination = AllocateZeroPool((Count+1)*sizeof(CHAR16)); } - *Destination = CopyMem(*Destination+StrLen(Source), *Destination, StrSize(*Destination)); + CopySize = StrSize(*Destination); + *Destination = CopyMem((*Destination)+StrLen(Source), *Destination, CopySize); *Destination = CopyMem(*Destination, Source, StrLen(Source)); return (*Destination); } @@ -798,7 +800,7 @@ FileHandleGetFileName ( } if (EFI_ERROR(Status) && *FullFileName != NULL) { - FreePool(FullFileName); + FreePool(*FullFileName); } return (Status); @@ -808,8 +810,8 @@ FileHandleGetFileName ( Function to read a single line (up to but not including the \n) from a file. @param[in] Handle FileHandle to read from - @param[in,out] Buffer pointer to buffer to read into - @param[in,out] Size pointer to number of bytes in buffer + @param[in,out] Buffer pointer to buffer to read into + @param[in,out] Size pointer to number of bytes in buffer @param[in[ Truncate if TRUE then allows for truncation of the line to fit. if FALSE will reset the position to the begining of the line if the buffer is not large enough.