summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-21 05:33:41 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-21 05:33:41 +0000
commit4a1102c9aedce3e4244efcc822794e9cc6da4dee (patch)
treea9301618d1f151ad546ef0a123874ae84501371d
parent29dd3b04b09d6efb3c2c3e79e71a998d9b6c79b3 (diff)
downloadedk2-4a1102c9aedce3e4244efcc822794e9cc6da4dee.zip
edk2-4a1102c9aedce3e4244efcc822794e9cc6da4dee.tar.gz
edk2-4a1102c9aedce3e4244efcc822794e9cc6da4dee.tar.bz2
K8:
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
-rw-r--r--MdeModulePkg/Include/Library/IfrSupportLib.h2
-rw-r--r--MdeModulePkg/Library/UefiHiiLib/HiiString.c9
-rw-r--r--MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrForm.c6
3 files changed, 12 insertions, 5 deletions
diff --git a/MdeModulePkg/Include/Library/IfrSupportLib.h b/MdeModulePkg/Include/Library/IfrSupportLib.h
index 1608d14..e7e04ba 100644
--- a/MdeModulePkg/Include/Library/IfrSupportLib.h
+++ b/MdeModulePkg/Include/Library/IfrSupportLib.h
@@ -852,6 +852,8 @@ BufToHexString (
If String has N valid hexadecimal characters for conversion, the caller must make sure Buffer is at least
N/2 (if N is even) or (N+1)/2 (if N if odd) bytes.
+ If either Buffer, BufferSizeInBytes or String is NULL, then ASSERT ().
+
@param Buffer The output buffer allocated by the caller.
@param BufferSizeInBytes On input, the size in bytes of Buffer. On output, it is updated to
contain the size of the Buffer which is actually used for the converstion.
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
index e10b1c7..c6cef6d 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c
@@ -325,8 +325,8 @@ HiiLibGetStringFromToken (
EFI_GUID Guid;
Status = HiiLibGetHiiHandles (&HandleBufferLen, &HiiHandleBuffer);
- if (EFI_ERROR(Status)) {
- return Status;
+ if (HiiHandleBuffer == NULL) {
+ return EFI_NOT_FOUND;
}
for (Index = 0; Index < (HandleBufferLen / sizeof (EFI_HII_HANDLE)); Index++) {
Status = HiiLibExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);
@@ -350,9 +350,8 @@ HiiLibGetStringFromToken (
Status = HiiLibGetStringFromHandle (HiiHandleBuffer[Index], StringId, String);
Out:
- if (HiiHandleBuffer != NULL) {
- FreePool (HiiHandleBuffer);
- }
+ FreePool (HiiHandleBuffer);
+
return Status;
}
diff --git a/MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrForm.c b/MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrForm.c
index bfca72e..1584c33 100644
--- a/MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrForm.c
+++ b/MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrForm.c
@@ -1562,6 +1562,8 @@ BufToHexString (
If String has N valid hexadecimal characters for conversion, the caller must make sure Buffer is at least
N/2 (if N is even) or (N+1)/2 (if N if odd) bytes.
+ If either Buffer, BufferSizeInBytes or String is NULL, then ASSERT ().
+
@param Buffer The output buffer allocated by the caller.
@param BufferSizeInBytes On input, the size in bytes of Buffer. On output, it is updated to
contain the size of the Buffer which is actually used for the converstion.
@@ -1592,6 +1594,10 @@ HexStringToBuf (
UINT8 Digit;
UINT8 Byte;
+ ASSERT (Buffer != NULL);
+ ASSERT (BufferSizeInBytes != NULL);
+ ASSERT (String != NULL);
+
//
// Find out how many hex characters the string has.
//