mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 1/2] check result from res_mkquery
@ 2016-05-25  9:22 Natanael Copa
  2016-05-25  9:22 ` [PATCH 2/2] refactor name_from_dns Natanael Copa
  0 siblings, 1 reply; 6+ messages in thread
From: Natanael Copa @ 2016-05-25  9:22 UTC (permalink / raw)
  To: musl; +Cc: Natanael Copa

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-29 16:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25  9:22 [PATCH 1/2] check result from res_mkquery Natanael Copa
2016-05-25  9:22 ` [PATCH 2/2] refactor name_from_dns Natanael Copa
2016-05-27  4:40   ` Rich Felker
2016-06-15 17:53     ` Natanael Copa
2016-06-15 18:27     ` [PATCH v2] " Natanael Copa
2016-06-29 16:04       ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).