Reviewed-by: Rebecca Cran <rebe...@bsdio.com>
On 2/20/2024 8:21 AM, mikub...@linux.microsoft.com wrote:
From: Michael Kubacki <michael.kuba...@microsoft.com>
Checks that an offset used to access array elements is within the
expected range before accessing the array item.
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Ray Ni <ray...@intel.com>
Cc: Rebecca Cran <rebe...@bsdio.com>
Cc: Richard Ho <richar...@ami.com>
Signed-off-by: Michael Kubacki <michael.kuba...@microsoft.com>
---
MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c | 2 +-
MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c | 2 +-
MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
index 29f4508a38ce..0c1f252b85df 100644
--- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
@@ -769,7 +769,7 @@ ConvertFilter (
Count = sizeof (gTable)/sizeof (gTable[0]);
- for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
+ for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
if (gTable[Index].Src & Value) {
*CdcFilter |= gTable[Index].Dst;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
index baa2225bf8a8..ef01a6f5458c 100644
--- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
@@ -855,7 +855,7 @@ ConvertFilter (
Count = sizeof (gTable)/sizeof (gTable[0]);
- for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
+ for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
if (gTable[Index].Src & Value) {
*CdcFilter |= gTable[Index].Dst;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
index 2c0dcae4cf96..6d45a1b775ba 100644
--- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
@@ -803,7 +803,7 @@ ConvertFilter (
Count = sizeof (gTable)/sizeof (gTable[0]);
- for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
+ for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
if (gTable[Index].Src & Value) {
*CdcFilter |= gTable[Index].Dst;
}
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115992): https://edk2.groups.io/g/devel/message/115992
Mute This Topic: https://groups.io/mt/104469090/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-