mirror of
https://frontier.innolan.net/rainlance/c-ares.git
synced 2025-10-05 18:42:01 +00:00
cleanup: avoid unsafe typecasts
Avoid the risk of reading 16bit data from an unaligned address by using a macro that is adapted for this.
This commit is contained in:
@ -47,7 +47,7 @@
|
||||
|
||||
int
|
||||
ares_parse_mx_reply (const unsigned char *abuf, int alen,
|
||||
struct ares_mx_reply **mx_out)
|
||||
struct ares_mx_reply **mx_out)
|
||||
{
|
||||
unsigned int qdcount, ancount, i;
|
||||
const unsigned char *aptr, *vptr;
|
||||
@ -134,7 +134,7 @@ ares_parse_mx_reply (const unsigned char *abuf, int alen,
|
||||
mx_last = mx_curr;
|
||||
|
||||
vptr = aptr;
|
||||
mx_curr->priority = ntohs (*((unsigned short *)vptr));
|
||||
mx_curr->priority = DNS__16BIT(vptr);
|
||||
vptr += sizeof(unsigned short);
|
||||
|
||||
status = ares_expand_name (vptr, abuf, alen, &mx_curr->host, &len);
|
||||
|
Reference in New Issue
Block a user