summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-05-25 11:22:13 +0200
committerRich Felker <dalias@aerifal.cx>2016-06-29 11:57:53 -0400
commit04bced403dead13d20a46a1bd00ab1eb2c50b882 (patch)
tree1f25de60512f672369ea219c98978742d634dd34
parent5c43e1dbc8716536551d392f834c6752a3e82cec (diff)
downloadmusl-04bced403dead13d20a46a1bd00ab1eb2c50b882.tar.gz
musl-04bced403dead13d20a46a1bd00ab1eb2c50b882.tar.bz2
musl-04bced403dead13d20a46a1bd00ab1eb2c50b882.tar.xz
musl-04bced403dead13d20a46a1bd00ab1eb2c50b882.zip
in performing dns lookups, check result from res_mkquery
don't send a query that may be malformed.
-rw-r--r--src/network/lookup_name.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/lookup_name.c b/src/network/lookup_name.c
index 86f90ac1..d3d97b48 100644
--- a/src/network/lookup_name.c
+++ b/src/network/lookup_name.c
@@ -145,11 +145,15 @@ static int name_from_dns(struct address buf[static MAXADDRS], char canon[static
if (family != AF_INET6) {
qlens[nq] = __res_mkquery(0, name, 1, RR_A, 0, 0, 0,
qbuf[nq], sizeof *qbuf);
+ if (qlens[nq] == -1)
+ return EAI_NONAME;
nq++;
}
if (family != AF_INET) {
qlens[nq] = __res_mkquery(0, name, 1, RR_AAAA, 0, 0, 0,
qbuf[nq], sizeof *qbuf);
+ if (qlens[nq] == -1)
+ return EAI_NONAME;
nq++;
}