]> git.proxmox.com Git - mirror_edk2.git/commitdiff
K8:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Jan 2009 05:33:41 +0000 (05:33 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Jan 2009 05:33:41 +0000 (05:33 +0000)
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

MdeModulePkg/Include/Library/IfrSupportLib.h
MdeModulePkg/Library/UefiHiiLib/HiiString.c
MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrForm.c

index 1608d14ab122c4d430eeec6dc69c264b49bbf3c2..e7e04ba99207c9690f1ff09e0756fcdcbae8f008 100644 (file)
@@ -852,6 +852,8 @@ BufToHexString (
   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
index e10b1c72ee54397e4f4cdc2e420408caf2d23d90..c6cef6dc62fd169473b111f9ce8be171a7040fd3 100644 (file)
@@ -325,8 +325,8 @@ HiiLibGetStringFromToken (
   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
@@ -350,9 +350,8 @@ HiiLibGetStringFromToken (
   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
index bfca72ec30d61c6759f79d482c101a9b891e27fd..1584c33d92a661fa88eda3768a0b1380106599fa 100644 (file)
@@ -1562,6 +1562,8 @@ BufToHexString (
   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
@@ -1592,6 +1594,10 @@ HexStringToBuf (
   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