diff --git a/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c b/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c index 05939c09e..0a6e24b4d 100644 --- a/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c +++ b/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c @@ -2654,7 +2654,7 @@ void test_vDHCPProcess_eWaitingOfferCorrectDHCPMessageTwoOptionsSendFails( void /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -2751,7 +2751,7 @@ void test_vDHCPProcess_eWaitingOfferCorrectDHCPMessageTwoOptionsSendSucceeds( vo /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -2853,7 +2853,7 @@ void test_vDHCPProcess_eWaitingOfferCorrectDHCPMessageTwoOptionsDHCPHookReturnDe /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -2952,7 +2952,7 @@ void test_vDHCPProcess_eWaitingOfferCorrectDHCPMessageTwoOptionsDHCPHookReturnEr /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3052,7 +3052,7 @@ void test_vDHCPProcess_eWaitingAcknowledgeTwoOptionsIncorrectServerNoTimeout( vo /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by * the FreeRTOS_recvrom. */ @@ -3137,7 +3137,7 @@ void test_vDHCPProcess_eWaitingAcknowledgeTwoOptionsIncorrectServerTimeoutGNBfai /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by * the FreeRTOS_recvrom. */ @@ -3227,7 +3227,7 @@ void test_vDHCPProcess_eWaitingAcknowledgeTwoOptionsIncorrectServerTimeoutGNBSuc /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3322,7 +3322,7 @@ void test_vDHCPProcess_eWaitingAcknowledgeTwoOptionsIncorrectServerTimeoutPeriod /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3407,7 +3407,7 @@ void test_vDHCPProcess_eWaitingAcknowledgeTwoOptionsIncorrectServerTimeoutPeriod /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3493,7 +3493,7 @@ void test_vDHCPProcess_eWaitingAcknowledgeTwoOptionsCorrectServerLeaseTimeZero( /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3594,7 +3594,7 @@ void test_vDHCPProcess_eWaitingAcknowledgeTwoOptionsCorrectServerLeaseTimeLessTh /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3693,7 +3693,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_TwoOptions_CorrectServer_AptLeaseTime /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3791,7 +3791,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_TwoOptions_NACK( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3878,7 +3878,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_TwoOptions_OFFER( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); /* Put the information in global variables to be returned by @@ -3980,7 +3980,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); DHCPOption += 6; /* Add Message type code. */ @@ -3988,7 +3988,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulSubnetMask; + memcpy( &DHCPOption[ 2 ], &ulSubnetMask, sizeof( ulSubnetMask ) ); DHCPOption += 6; /* Add Message type code. */ @@ -3996,7 +3996,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulGateway; + memcpy( &DHCPOption[ 2 ], &ulGateway, sizeof( ulGateway ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4004,7 +4004,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulLeaseTime; + memcpy( &DHCPOption[ 2 ], &ulLeaseTime, sizeof( ulLeaseTime ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4012,7 +4012,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulDNSServer; + memcpy( &DHCPOption[ 2 ], &ulDNSServer, sizeof( ulDNSServer ) ); /* Put the information in global variables to be returned by @@ -4126,7 +4126,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength2( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4134,7 +4134,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength2( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulSubnetMask; + memcpy( &DHCPOption[ 2 ], &ulSubnetMask, sizeof( ulSubnetMask ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4142,7 +4142,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength2( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulGateway; + memcpy( &DHCPOption[ 2 ], &ulGateway, sizeof( ulGateway ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4150,7 +4150,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength2( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulLeaseTime; + memcpy( &DHCPOption[ 2 ], &ulLeaseTime, sizeof( ulLeaseTime ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4158,7 +4158,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_AllOptionsCorrectLength2( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulDNSServer; + memcpy( &DHCPOption[ 2 ], &ulDNSServer, sizeof( ulDNSServer ) ); /* Put the information in global variables to be returned by @@ -4273,7 +4273,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSIncorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4281,7 +4281,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSIncorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulSubnetMask; + memcpy( &DHCPOption[ 2 ], &ulSubnetMask, sizeof( ulSubnetMask ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4289,7 +4289,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSIncorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulGateway; + memcpy( &DHCPOption[ 2 ], &ulGateway, sizeof( ulGateway ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4297,7 +4297,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSIncorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulLeaseTime; + memcpy( &DHCPOption[ 2 ], &ulLeaseTime, sizeof( ulLeaseTime ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4305,7 +4305,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSIncorrectLength( void ) /* Add length. */ DHCPOption[ 1 ] = 3; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulDNSServer; + memcpy( &DHCPOption[ 2 ], &ulDNSServer, sizeof( ulDNSServer ) ); /* Put the information in global variables to be returned by @@ -4415,7 +4415,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSServerOverabundance( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = DHCPServerAddress; + memcpy( &DHCPOption[ 2 ], &DHCPServerAddress, sizeof( DHCPServerAddress ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4423,7 +4423,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSServerOverabundance( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulSubnetMask; + memcpy( &DHCPOption[ 2 ], &ulSubnetMask, sizeof( ulSubnetMask ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4431,7 +4431,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSServerOverabundance( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulGateway; + memcpy( &DHCPOption[ 2 ], &ulGateway, sizeof( ulGateway ) ); DHCPOption += 6; /* Add Message type code. */ @@ -4439,7 +4439,7 @@ void test_vDHCPProcess_eWaitingAcknowledge_DNSServerOverabundance( void ) /* Add length. */ DHCPOption[ 1 ] = 4; /* Add the offer byte. */ - *( ( uint32_t * ) &DHCPOption[ 2 ] ) = ulLeaseTime; + memcpy( &DHCPOption[ 2 ], &ulLeaseTime, sizeof( ulLeaseTime ) ); DHCPOption += 6; /* Add Message type code. */