On 27.02.24 07:37, Chao Li wrote:
DevicePathFromTextBBTextCoverage.c function CreateDNSDeviceNode has a
bug, code:
SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)(DNS + sizeof
(DNS_DEVICE_PATH)));
DNS is a pointer, which is increased by a structure size and converted
to EFI_IPv4_ADDRESS*, which will point to an unknown address. So fix it.
Fixes: 847e0363e846 ("SctPkg: Fix the UefiSct-Wincompatible-pointer-types
warnings")
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4712
Cc: G Edhaya Chandran <edhaya.chand...@arm.com>
Cc: Barton Gao <gao...@byosoft.com.cn>
Cc: Carolyn Gjertsen <carolyn.gjert...@amd.com>
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@arm.com>
Cc: Eric Jin <eric....@intel.com>
Cc: Arvin Chen <arvinx.c...@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkat...@amd.com>
Cc: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
Signed-off-by: Chao Li <lic...@loongson.cn>
---
.../BlackBoxTest/DevicePathFromTextBBTestCoverage.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
index c96ee246..bd11c25a 100644
---
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
+++
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
@@ -1734,13 +1734,13 @@ CreateDNSDeviceNode (
}
if (DNS->IsIPv6 == 0) {
- SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)(DNS + sizeof
(DNS_DEVICE_PATH)));
- SctStrToIPv4Addr (&IpStr2, (EFI_IPv4_ADDRESS *)(DNS + sizeof
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+ SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof
(DNS_DEVICE_PATH)));
+ SctStrToIPv4Addr (&IpStr2, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
}
if (DNS->IsIPv6 == 1) {
- SctStrToIPv6Addr (&IpStr1, (EFI_IPv6_ADDRESS *)(DNS + sizeof
(DNS_DEVICE_PATH)));
- SctStrToIPv6Addr (&IpStr2, (EFI_IPv6_ADDRESS *)(DNS + sizeof
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+ SctStrToIPv6Addr (&IpStr1, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof
(DNS_DEVICE_PATH)));
+ SctStrToIPv6Addr (&IpStr2, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof
(DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
}
return (EFI_DEVICE_PATH_PROTOCOL *) DNS;
Reviewed-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116044): https://edk2.groups.io/g/devel/message/116044
Mute This Topic: https://groups.io/mt/104598721/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-