about summary refs log tree commit diff
path: root/resolv/nss_dns/dns-canon.c
diff options
context:
space:
mode:
Diffstat (limited to 'resolv/nss_dns/dns-canon.c')
-rw-r--r--resolv/nss_dns/dns-canon.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c
index cb321a0650..1cdc9a86c9 100644
--- a/resolv/nss_dns/dns-canon.c
+++ b/resolv/nss_dns/dns-canon.c
@@ -150,15 +150,18 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
 	      if (type != ns_t_cname)
 		goto unavail;
 
-	      if (__ns_get16 (ptr) != ns_c_in)
+	      uint16_t rrclass;
+	      NS_GET16 (rrclass, ptr);
+	      if (rrclass != ns_c_in)
 		goto unavail;
 
-	      /* Also skip over class and TTL.  */
-	      ptr += sizeof (uint16_t) + sizeof (uint32_t);
+	      /* Skip over TTL.  */
+	      ptr += sizeof (uint32_t);
 
 	      /* Skip over RDATA length and RDATA itself.  */
-	      uint16_t rdatalen = __ns_get16 (ptr);
-	      ptr += sizeof (uint16_t);
+	      uint16_t rdatalen;
+	      NS_GET16 (rdatalen, ptr);
+
 	      /* Not enough room for RDATA.  */
 	      if (endptr - ptr < rdatalen)
 		goto unavail;