From 64cf63ecb2a236ef7c382e5ded71e93f98b4af0c Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 27 Nov 2024 07:33:11 -0800 Subject: [PATCH] [test] fix address list comparison in `spinel_prop_codec` (#10954) This commit updates how address lists are compared in the unit test `spinel_prop_codec`, ensuring that the correct size based on the array length is passed to `memcmp()`. --- tests/unit/test_spinel_prop_codec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_spinel_prop_codec.cpp b/tests/unit/test_spinel_prop_codec.cpp index 2506f9438..85bbba5df 100644 --- a/tests/unit/test_spinel_prop_codec.cpp +++ b/tests/unit/test_spinel_prop_codec.cpp @@ -84,8 +84,8 @@ void TestDnssd(void) SuccessOrQuit(error = DecodeDnssdHost(decoder, dnssdHostDecode, requestId, callbackData, callbackDataLen)); VerifyOrQuit(strcmp(dnssdHostDecode.mHostName, dnssdHostEncode.mHostName) == 0); VerifyOrQuit(dnssdHostDecode.mAddressesLength == dnssdHostEncode.mAddressesLength); - VerifyOrQuit(memcmp(dnssdHostDecode.mAddresses, dnssdHostEncode.mAddresses, sizeof(dnssdHostEncode.mAddresses)) == - 0); + VerifyOrQuit(memcmp(dnssdHostDecode.mAddresses, dnssdHostEncode.mAddresses, + dnssdHostDecode.mAddressesLength * sizeof(otIp6Address)) == 0); VerifyOrQuit(requestId == 1); VerifyOrQuit(callbackDataLen == sizeof(otPlatDnssdRegisterCallback)); VerifyOrQuit(*reinterpret_cast(callbackData) == DnssdFakeCallback);