1) add in more ASSERT condition and updates the comment for HexStringToBuf.
2) Check the pointer returned by HiiLibGetHiiHandles.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7324
6f19259b-4bc3-4df7-8a09-
765794883524
If String has N valid hexadecimal characters for conversion, the caller must make sure Buffer is at least \r
N/2 (if N is even) or (N+1)/2 (if N if odd) bytes. \r
\r
+ If either Buffer, BufferSizeInBytes or String is NULL, then ASSERT ().\r
+\r
@param Buffer The output buffer allocated by the caller.\r
@param BufferSizeInBytes On input, the size in bytes of Buffer. On output, it is updated to \r
contain the size of the Buffer which is actually used for the converstion.\r
EFI_GUID Guid;\r
\r
Status = HiiLibGetHiiHandles (&HandleBufferLen, &HiiHandleBuffer);\r
- if (EFI_ERROR(Status)) {\r
- return Status;\r
+ if (HiiHandleBuffer == NULL) {\r
+ return EFI_NOT_FOUND;\r
}\r
for (Index = 0; Index < (HandleBufferLen / sizeof (EFI_HII_HANDLE)); Index++) {\r
Status = HiiLibExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);\r
Status = HiiLibGetStringFromHandle (HiiHandleBuffer[Index], StringId, String);\r
\r
Out:\r
- if (HiiHandleBuffer != NULL) {\r
- FreePool (HiiHandleBuffer);\r
- }\r
+ FreePool (HiiHandleBuffer);\r
+\r
return Status;\r
}\r
\r
If String has N valid hexadecimal characters for conversion, the caller must make sure Buffer is at least \r
N/2 (if N is even) or (N+1)/2 (if N if odd) bytes. \r
\r
+ If either Buffer, BufferSizeInBytes or String is NULL, then ASSERT ().\r
+\r
@param Buffer The output buffer allocated by the caller.\r
@param BufferSizeInBytes On input, the size in bytes of Buffer. On output, it is updated to \r
contain the size of the Buffer which is actually used for the converstion.\r
UINT8 Digit;\r
UINT8 Byte;\r
\r
+ ASSERT (Buffer != NULL);\r
+ ASSERT (BufferSizeInBytes != NULL);\r
+ ASSERT (String != NULL);\r
+\r
//\r
// Find out how many hex characters the string has.\r
//\r