about summary refs log tree commit diff
path: root/resolv/res_mkquery.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-12-31 20:22:09 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-12-31 20:27:44 +0100
commitfc82b0a2dfe7dbd35671c10510a8da1043d746a5 (patch)
tree86b8ef6421ca34fa1907121e078e008c580029ea /resolv/res_mkquery.c
parent3c589b1a8a4401e258ba23a03fcbcc79b82393ab (diff)
downloadglibc-fc82b0a2dfe7dbd35671c10510a8da1043d746a5.tar.gz
glibc-fc82b0a2dfe7dbd35671c10510a8da1043d746a5.tar.xz
glibc-fc82b0a2dfe7dbd35671c10510a8da1043d746a5.zip
CVE-2015-5180: resolv: Fix crash with internal QTYPE [BZ #18784]
Also rename T_UNSPEC because an upcoming public header file
update will use that name.
Diffstat (limited to 'resolv/res_mkquery.c')
-rw-r--r--resolv/res_mkquery.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 12f9730199..d80b5318e5 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -103,6 +103,10 @@ res_nmkquery(res_state statp,
 	int n;
 	u_char *dnptrs[20], **dpp, **lastdnptr;
 
+	if (class < 0 || class > 65535
+	    || type < 0 || type > 65535)
+	  return -1;
+
 #ifdef DEBUG
 	if (statp->options & RES_DEBUG)
 		printf(";; res_nmkquery(%s, %s, %s, %s)\n",