summaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-13 09:23:55 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-13 09:23:55 +0000
commitb77ab157d4bbccd7b67fb59e6b22d925be065169 (patch)
treec0a6e736aa9afe74000c736e96ee7fae5b15ad8d /resolv
parentca0350310e775f12d1f5a5f8b99d32bc6f69f274 (diff)
Update from main branch.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/nss_dns/dns-host.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 078d452fd6..b982481349 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -323,6 +323,15 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
int (*name_ok) __P ((const char *));
u_char packtmp[NS_MAXCDNAME];
+ if (linebuflen < 0)
+ {
+ /* The buffer is too small. */
+ too_small:
+ *errnop = ERANGE;
+ *h_errnop = NETDB_INTERNAL;
+ return NSS_STATUS_TRYAGAIN;
+ }
+
tname = qname;
result->h_name = NULL;
end_of_message = answer->buf + anslen;
@@ -358,11 +367,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
{
if (errno == EMSGSIZE)
- {
- *errnop = ERANGE;
- *h_errnop = NETDB_INTERNAL;
- return NSS_STATUS_TRYAGAIN;
- }
+ goto too_small;
n = -1;
}
@@ -393,6 +398,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
result->h_name = bp;
bp += n;
linebuflen -= n;
+ if (linebuflen < 0)
+ goto too_small;
/* The qname can be abbreviated, but h_name is now absolute. */
qname = result->h_name;
}
@@ -606,6 +613,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
linebuflen -= nn;
}
+ linebuflen -= sizeof (align) - ((u_long) bp % sizeof (align));
bp += sizeof (align) - ((u_long) bp % sizeof (align));
if (n >= linebuflen)