diff --git a/Nt32Pkg/CpuRuntimeDxe/CpuIo.c b/Nt32Pkg/CpuRuntimeDxe/CpuIo.c index e4f056ceda..272a8d7b6b 100644 --- a/Nt32Pkg/CpuRuntimeDxe/CpuIo.c +++ b/Nt32Pkg/CpuRuntimeDxe/CpuIo.c @@ -1,6 +1,6 @@ /**@file -Copyright (c) 2006 - 2009, Intel Corporation +Copyright (c) 2006 - 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -81,6 +81,10 @@ Returns: return EFI_INVALID_PARAMETER; } + if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) { + return EFI_INVALID_PARAMETER; + } + Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS); if (EFI_ERROR (Status)) { return Status; @@ -135,6 +139,10 @@ Returns: return EFI_INVALID_PARAMETER; } + if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) { + return EFI_INVALID_PARAMETER; + } + Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS); if (EFI_ERROR (Status)) { return Status; @@ -192,7 +200,7 @@ Returns: Address = (UINTN) UserAddress; - if (Width >= EfiCpuIoWidthMaximum) { + if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) { return EFI_INVALID_PARAMETER; } @@ -257,7 +265,7 @@ Returns: Address = (UINTN) UserAddress; - if (Width >= EfiCpuIoWidthMaximum) { + if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) { return EFI_INVALID_PARAMETER; }