Revision: 18430
http://sourceforge.net/p/edk2/code/18430
Author: shenshushi
Date: 2015-09-10 02:45:30 +0000 (Thu, 10 Sep 2015)
Log Message:
-----------
MdePkg: Refine UefiFileHandleLib to avoid write non-ASCII char into ASCII file.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
Modified: trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
===================================================================
--- trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
2015-09-09 15:30:37 UTC (rev 18429)
+++ trunk/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
2015-09-10 02:45:30 UTC (rev 18430)
@@ -1079,6 +1079,7 @@
EFI_STATUS Status;
CHAR16 CharBuffer;
UINTN Size;
+ UINTN Index;
UINTN CharSize;
UINT64 FileSize;
UINT64 OriginalFilePosition;
@@ -1136,6 +1137,12 @@
return EFI_OUT_OF_RESOURCES;
}
UnicodeStrToAsciiStr (Buffer, AsciiBuffer);
+ for (Index = 0; Index < Size; Index++) {
+ if (!((AsciiBuffer[Index] >= 0) && (AsciiBuffer[Index] < 128))){
+ FreePool(AsciiBuffer);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
Size = AsciiStrSize(AsciiBuffer) - sizeof(CHAR8);
Status = FileHandleWrite(Handle, &Size, AsciiBuffer);
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits