aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/net/name6.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2000-07-03 08:20:11 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2000-07-03 08:20:11 +0000
commit792b0bd86d6da457e14bfce0a7659667267e081f (patch)
tree7e56066730dcc831ab3c8f898c8f82c85144101e /lib/libc/net/name6.c
parenteee21bf447ffd97c204596441acee71d4ed953f1 (diff)
downloadsrc-792b0bd86d6da457e14bfce0a7659667267e081f.tar.gz
src-792b0bd86d6da457e14bfce0a7659667267e081f.zip
MFC: (rev 1.13) fix a null-dereference problem.
PR: 19069
Notes
Notes: svn path=/stable/4/; revision=62443
Diffstat (limited to 'lib/libc/net/name6.c')
-rw-r--r--lib/libc/net/name6.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 32fe460f4155..db407dd163cc 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;
@@ -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;