diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-21 06:14:44 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-21 06:14:44 +0000 |
commit | 8b23eb867c6fdd2136291ec8b505c5c593409245 (patch) | |
tree | 6d02e119b5e60b940979ce8851f31953d4661d49 /MdeModulePkg/Universal/HiiDatabaseDxe | |
parent | dd651262a551fc7dcdd3569127b199cec316b136 (diff) | |
download | edk2-8b23eb867c6fdd2136291ec8b505c5c593409245.tar.gz edk2-8b23eb867c6fdd2136291ec8b505c5c593409245.tar.bz2 edk2-8b23eb867c6fdd2136291ec8b505c5c593409245.zip |
Sync patch r12472 from main trunk.
Add pointer check for NULL before dereference it.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@12952 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe')
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/String.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c index 321b2f7040..81969e040e 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c @@ -339,6 +339,7 @@ FindStringBlock ( for (Index = 0; Index < StringCount; Index++) {
BlockSize += AsciiStrSize ((CHAR8 *) StringTextPtr);
if (CurrentStringId == StringId) {
+ ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
*BlockType = *BlockHdr;
*StringBlockAddr = BlockHdr;
*StringTextOffset = StringTextPtr - BlockHdr;
@@ -361,6 +362,7 @@ FindStringBlock ( for (Index = 0; Index < StringCount; Index++) {
BlockSize += AsciiStrSize ((CHAR8 *) StringTextPtr);
if (CurrentStringId == StringId) {
+ ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
*BlockType = *BlockHdr;
*StringBlockAddr = BlockHdr;
*StringTextOffset = StringTextPtr - BlockHdr;
@@ -404,6 +406,7 @@ FindStringBlock ( GetUnicodeStringTextOrSize (NULL, StringTextPtr, &StringSize);
BlockSize += StringSize;
if (CurrentStringId == StringId) {
+ ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
*BlockType = *BlockHdr;
*StringBlockAddr = BlockHdr;
*StringTextOffset = StringTextPtr - BlockHdr;
@@ -427,6 +430,7 @@ FindStringBlock ( GetUnicodeStringTextOrSize (NULL, StringTextPtr, &StringSize);
BlockSize += StringSize;
if (CurrentStringId == StringId) {
+ ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
*BlockType = *BlockHdr;
*StringBlockAddr = BlockHdr;
*StringTextOffset = StringTextPtr - BlockHdr;
@@ -559,7 +563,7 @@ FindStringBlock ( //
// Get last string ID
//
- if (StringId == (EFI_STRING_ID) (-1)) {
+ if (StringId == (EFI_STRING_ID) (-1) && LastStringId != NULL) {
*LastStringId = (EFI_STRING_ID) (CurrentStringId - 1);
return EFI_SUCCESS;
}
|