aboutsummaryrefslogtreecommitdiff
path: root/resolv/nss_dns/dns-host.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-07-15 08:28:50 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-07-15 08:39:02 +0200
commit2ff32dd4926c7ec3bb6c09b58a12a8e828a4cc58 (patch)
tree3f95064771e01583725f69f940581a07be661c2c /resolv/nss_dns/dns-host.c
parent389c1114d122d78fcf2d4d08ffd6335853c8adef (diff)
downloadglibc-2ff32dd4926c7ec3bb6c09b58a12a8e828a4cc58.zip
glibc-2ff32dd4926c7ec3bb6c09b58a12a8e828a4cc58.tar.gz
glibc-2ff32dd4926c7ec3bb6c09b58a12a8e828a4cc58.tar.bz2
nss_dns: Do not use deprecated packet parsing functions
Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'resolv/nss_dns/dns-host.c')
-rw-r--r--resolv/nss_dns/dns-host.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 47e851db..d6a69a6 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -782,14 +782,11 @@ getanswer_r (struct resolv_context *ctx,
continue;
}
- type = __ns_get16 (cp);
- cp += INT16SZ; /* type */
- class = __ns_get16 (cp);
- cp += INT16SZ; /* class */
- int32_t ttl = __ns_get32 (cp);
- cp += INT32SZ; /* TTL */
- n = __ns_get16 (cp);
- cp += INT16SZ; /* len */
+ NS_GET16 (type, cp);
+ NS_GET16 (class, cp);
+ int32_t ttl;
+ NS_GET32 (ttl, cp);
+ NS_GET16 (n, cp); /* RDATA length. */
if (end_of_message - cp < n)
{
@@ -1116,14 +1113,13 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
continue;
}
- int type = __ns_get16 (cp);
- cp += INT16SZ; /* type */
- int class = __ns_get16 (cp);
- cp += INT16SZ; /* class */
- int32_t ttl = __ns_get32 (cp);
- cp += INT32SZ; /* TTL */
- n = __ns_get16 (cp);
- cp += INT16SZ; /* len */
+ uint16_t type;
+ NS_GET16 (type, cp);
+ uint16_t class;
+ NS_GET16 (class, cp);
+ int32_t ttl;
+ NS_GET32 (ttl, cp);
+ NS_GET16 (n, cp); /* RDATA length. */
if (end_of_message - cp < n)
{