Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1464168134-17039-1-git-send-email-ncopa@alpinelinux.org>
Date: Wed, 25 May 2016 11:22:13 +0200
From: Natanael Copa <ncopa@...inelinux.org>
To: musl@...ts.openwall.com
Cc: Natanael Copa <ncopa@...inelinux.org>
Subject: [PATCH 1/2] check result from res_mkquery

we don't want to try send a query that may be malformatted.
---
 src/network/lookup_name.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/network/lookup_name.c b/src/network/lookup_name.c
index 86f90ac..d3d97b4 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++;
 	}
 
-- 
2.8.2

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.