summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-10 09:24:40 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-10 09:24:40 +0000
commit601afc03569bd62795dcb4736521862494300e8c (patch)
tree54ae1c279ea7457673764660eb389b2d1c301616
parentd90434ccb53d7ca320c84624bca8cf4ba8542196 (diff)
downloadedk2-platforms-601afc03569bd62795dcb4736521862494300e8c.tar.xz
Add legacy region range check.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9549 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/LegacyRegion2Dxe/LegacyRegion2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/LegacyRegion2Dxe/LegacyRegion2.c b/MdeModulePkg/Universal/LegacyRegion2Dxe/LegacyRegion2.c
index 80de38c484..9838fa8b8f 100644
--- a/MdeModulePkg/Universal/LegacyRegion2Dxe/LegacyRegion2.c
+++ b/MdeModulePkg/Universal/LegacyRegion2Dxe/LegacyRegion2.c
@@ -64,6 +64,10 @@ LegacyRegion2Decode (
IN BOOLEAN *On
)
{
+ if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ASSERT (Granularity != NULL);
*Granularity = 0;
return EFI_SUCCESS;
@@ -98,6 +102,10 @@ LegacyRegion2Lock (
OUT UINT32 *Granularity
)
{
+ if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ASSERT (Granularity != NULL);
*Granularity = 0;
return EFI_SUCCESS;
@@ -137,6 +145,10 @@ LegacyRegion2BootLock (
OUT UINT32 *Granularity
)
{
+ if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ASSERT (Granularity != NULL);
*Granularity = 0;
return EFI_SUCCESS;
@@ -171,6 +183,10 @@ LegacyRegion2Unlock (
OUT UINT32 *Granularity
)
{
+ if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ASSERT (Granularity != NULL);
*Granularity = 0;
return EFI_SUCCESS;