diff options
author | Daniel Stenberg <daniel@haxx.se> | 2010-12-18 22:20:16 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-12-18 22:20:16 +0100 |
commit | 2d5ed6400ba430f412ebc9748eb847771907776d (patch) | |
tree | bbe36882fb4e4ff5d2cb30ab5851fa0d25a8fbb0 /ares_parse_srv_reply.c | |
parent | 70b726c3343f83d7d3460dce0b24e8930c6f6195 (diff) | |
download | c-ares-2d5ed6400ba430f412ebc9748eb847771907776d.tar.gz c-ares-2d5ed6400ba430f412ebc9748eb847771907776d.tar.bz2 c-ares-2d5ed6400ba430f412ebc9748eb847771907776d.zip |
cleanup: avoid unsafe typecasts
Avoid the risk of reading 16bit data from an unaligned address by using
a macro that is adapted for this.
Diffstat (limited to 'ares_parse_srv_reply.c')
-rw-r--r-- | ares_parse_srv_reply.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ares_parse_srv_reply.c b/ares_parse_srv_reply.c index 7d443b3..9c7eb6e 100644 --- a/ares_parse_srv_reply.c +++ b/ares_parse_srv_reply.c @@ -139,11 +139,11 @@ ares_parse_srv_reply (const unsigned char *abuf, int alen, srv_last = srv_curr; vptr = aptr; - srv_curr->priority = ntohs (*((unsigned short *)vptr)); + srv_curr->priority = DNS__16BIT(vptr); vptr += sizeof(unsigned short); - srv_curr->weight = ntohs (*((unsigned short *)vptr)); + srv_curr->weight = DNS__16BIT(vptr); vptr += sizeof(unsigned short); - srv_curr->port = ntohs (*((unsigned short *)vptr)); + srv_curr->port = DNS__16BIT(vptr); vptr += sizeof(unsigned short); status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len); |