diff options
author | kris <kris@FreeBSD.org> | 2000-07-03 04:43:14 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-07-03 04:43:14 +0000 |
commit | 412dc02ecf4a7a0521608fa1be249a3f5fd944f4 (patch) | |
tree | 4966babaabc80d4498c96ed0ab3d76a07b7bbb80 | |
parent | 991a8601b5e75c8134dc66598d63ff2fc3454521 (diff) | |
download | FreeBSD-src-412dc02ecf4a7a0521608fa1be249a3f5fd944f4.zip FreeBSD-src-412dc02ecf4a7a0521608fa1be249a3f5fd944f4.tar.gz |
Previous commit broke the case of chained CNAME entries. Instead handle
the bogus case by being stricter about errors.
Submitted by: itojun
Obtained from: KAME
-rw-r--r-- | lib/libc/net/name6.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c index 2368d82..db407dd 100644 --- a/lib/libc/net/name6.c +++ b/lib/libc/net/name6.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $KAME: name6.c,v 1.22 2000/05/01 08:19:08 itojun Exp $ */ +/* $KAME: name6.c,v 1.25 2000/06/26 16:44:40 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. @@ -1051,21 +1051,23 @@ getanswer(answer, anslen, qname, qtype, template, errp) } \ } while (0) +/* XXX do {} while (0) cannot be put here */ #define DNS_ASSERT(x) \ - do { \ + { \ if (!(x)) { \ cp += n; \ continue; \ } \ - } while (0) + } +/* XXX do {} while (0) cannot be put here */ #define DNS_FATAL(x) \ - do { \ + { \ if (!(x)) { \ had_error++; \ continue; \ } \ - } while (0) + } tname = qname; template->h_name = NULL; @@ -1185,7 +1187,7 @@ getanswer(answer, anslen, qname, qtype, template, errp) continue; } strcpy(bp, tbuf); - template->h_name = bp; + tname = bp; bp += n; buflen -= n; continue; @@ -1326,6 +1328,8 @@ _res_search_multi(name, rtl, errp) hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); hp = getanswer(&buf, ret, name, rtl->rtl_type, &hpbuf, errp); + if (!hp) + continue; hp = _hpcopy(&hpbuf, errp); hp0 = _hpmerge(hp0, hp, errp); } @@ -1349,6 +1353,8 @@ _res_search_multi(name, rtl, errp) hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); hp = getanswer(&buf, ret, name, rtl->rtl_type, &hpbuf, errp); + if (!hp) + continue; hp = _hpcopy(&hpbuf, errp); hp0 = _hpmerge(hp0, hp, errp); } @@ -1384,6 +1390,8 @@ _res_search_multi(name, rtl, errp) hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); hp = getanswer(&buf, ret, name, rtl->rtl_type, &hpbuf, errp); + if (!hp) + continue; hp = _hpcopy(&hpbuf, errp); hp0 = _hpmerge(hp0, hp, errp); } @@ -1452,6 +1460,8 @@ _res_search_multi(name, rtl, errp) hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype); hp = getanswer(&buf, ret, name, rtl->rtl_type, &hpbuf, errp); + if (!hp) + continue; hp = _hpcopy(&hpbuf, errp); hp0 = _hpmerge(hp0, hp, errp); } @@ -1578,6 +1588,8 @@ _dns_ghbyaddr(const void *addr, int addrlen, int af, int *errp) return NULL; } hp = getanswer(&buf, n, qbuf, T_PTR, &hbuf, errp); + if (!hp) + return NULL; hbuf.h_addrtype = af; hbuf.h_length = addrlen; hbuf.h_addr_list = hlist; |