aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-12 07:38:32 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-12 07:38:32 +0000
commit88a96b8102533326b345f45fccbc00e36d031cca (patch)
tree851ababdfd0287339756fc79bbbc91bd214aa3cb
parentc17f665ba8b7972272bc5748a1ce5baed0ceeb74 (diff)
downloadglibc-88a96b8102533326b345f45fccbc00e36d031cca.zip
glibc-88a96b8102533326b345f45fccbc00e36d031cca.tar.gz
glibc-88a96b8102533326b345f45fccbc00e36d031cca.tar.bz2
Update.
2001-12-11 Ulrich Drepper <drepper@redhat.com> * resolv/nss_dns/dns-host.c (getanswer_r): Remove MAX_NR_ADDRS limitation [PR libc/2564].
-rw-r--r--ChangeLog5
-rw-r--r--resolv/nss_dns/dns-host.c15
2 files changed, 11 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c54b4d..b0f7529 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-11 Ulrich Drepper <drepper@redhat.com>
+
+ * resolv/nss_dns/dns-host.c (getanswer_r): Remove MAX_NR_ADDRS
+ limitation [PR libc/2564].
+
2001-12-11 Jakub Jelinek <jakub@redhat.com>
* elf/Makefile (dl-routines): Add conflict.
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index a75e9df..7b82486 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -387,10 +387,9 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
{
char *aliases[MAX_NR_ALIASES];
unsigned char host_addr[16]; /* IPv4 or IPv6 */
- char *h_addr_ptrs[MAX_NR_ADDRS + 1];
- char linebuffer[0];
+ char *h_addr_ptrs[0];
} *host_data = (struct host_data *) buffer;
- int linebuflen = buflen - offsetof (struct host_data, linebuffer);
+ int linebuflen = buflen - sizeof (struct host_data);
register const HEADER *hp;
const u_char *end_of_message, *cp;
int n, ancount, qdcount;
@@ -432,7 +431,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
* find first satisfactory answer
*/
hp = &answer->hdr;
- bp = host_data->linebuffer;
ancount = ntohs (hp->ancount);
qdcount = ntohs (hp->qdcount);
cp = answer->buf + HFIXEDSZ;
@@ -442,6 +440,10 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
*errnop = ENOENT;
return NSS_STATUS_UNAVAIL;
}
+ if (sizeof (struct host_data) + (ancount + 1) * sizeof (char *) >= buflen)
+ goto too_small;
+ bp = (char *) &host_data->h_addr_ptrs[ancount + 1];
+ linebuflen -= (ancount + 1) * sizeof (char *);
n = __ns_name_unpack (answer->buf, end_of_message, cp,
packtmp, sizeof packtmp);
@@ -701,11 +703,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (__builtin_expect (n > linebuflen, 0))
goto too_small;
- if (hap >= &host_data->h_addr_ptrs[MAX_NR_ADDRS-1])
- {
- cp += n;
- continue;
- }
bp = __mempcpy (*hap++ = bp, cp, n);
cp += n;
linebuflen -= n;