@@ -808,12 +808,12 @@ namespace
808808 if (isIPv6)
809809 {
810810 queryResult.kind = NetworkAddress::AddressKindIPv6;
811- uint16_t *ipv6 = reinterpret_cast < uint16_t *>(& queryResult.ipv6 [ 0 ]) ;
811+ uint8_t *ipv6 = queryResult.ipv6 ;
812812 // Enforce machine byte order by block of 2 byte.
813813 for (int i = 0 ; i < 8 ; i++)
814814 {
815- *ipv6++ = ntohs (
816- * reinterpret_cast <uint16_t * >(dnsPacket + currentOffset));
815+ *ipv6++ =
816+ ntohs (read_unaligned <uint16_t >(dnsPacket + currentOffset));
817817 currentOffset += 2 ;
818818 }
819819 }
@@ -1110,15 +1110,15 @@ __cheri_compartment("DNS") int network_host_resolve(Timeout *timeout,
11101110 {
11111111 Debug::log (" Resolved {} -> {}:{}:{}:{}:{}:{}:{}:{}" ,
11121112 hostname,
1113- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [0 ]),
1114- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [2 ]),
1115- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [4 ]),
1116- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [6 ]),
1117- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [8 ]),
1118- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [10 ]),
1119- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [12 ]),
1120- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [14 ]),
1121- * reinterpret_cast <uint16_t * >(&queryResult.ipv6 [16 ]));
1113+ read_unaligned <uint16_t >(&queryResult.ipv6 [0 ]),
1114+ read_unaligned <uint16_t >(&queryResult.ipv6 [2 ]),
1115+ read_unaligned <uint16_t >(&queryResult.ipv6 [4 ]),
1116+ read_unaligned <uint16_t >(&queryResult.ipv6 [6 ]),
1117+ read_unaligned <uint16_t >(&queryResult.ipv6 [8 ]),
1118+ read_unaligned <uint16_t >(&queryResult.ipv6 [10 ]),
1119+ read_unaligned <uint16_t >(&queryResult.ipv6 [12 ]),
1120+ read_unaligned <uint16_t >(&queryResult.ipv6 [14 ]),
1121+ read_unaligned <uint16_t >(&queryResult.ipv6 [16 ]));
11221122 }
11231123
11241124 // We are now good to process the next lookup.
0 commit comments