Module Name: src
Committed By: christos
Date: Tue Nov 11 03:29:24 UTC 2014
Modified Files:
src/lib/libc/resolv: res_mkquery.c
Log Message:
PR/48475: YAMAGUCHI Takanori: EDNS option broken with unbound. struct
querybuf in net/gethnamaddr.c defines MAXPACKET to 64K. This in turn
gets passed down until it reached res_nopt(..., answer, anslen), where
the size of the buffer must fit in 16 bits. Unfortunately we end up
being one more than the max so we end up sending a 0 as the size and
unbound does not like that. Instead we clip now to 64K - 1, and everyone
is happy.
XXX: Pullup to 7.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/resolv/res_mkquery.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/resolv/res_mkquery.c
diff -u src/lib/libc/resolv/res_mkquery.c:1.13 src/lib/libc/resolv/res_mkquery.c:1.14
--- src/lib/libc/resolv/res_mkquery.c:1.13 Tue Mar 13 17:13:43 2012
+++ src/lib/libc/resolv/res_mkquery.c Mon Nov 10 22:29:24 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: res_mkquery.c,v 1.13 2012/03/13 21:13:43 christos Exp $ */
+/* $NetBSD: res_mkquery.c,v 1.14 2014/11/11 03:29:24 christos Exp $ */
/*
* Portions Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
@@ -76,7 +76,7 @@
static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "Id: res_mkquery.c,v 1.10 2008/12/11 09:59:00 marka Exp";
#else
-__RCSID("$NetBSD: res_mkquery.c,v 1.13 2012/03/13 21:13:43 christos Exp $");
+__RCSID("$NetBSD: res_mkquery.c,v 1.14 2014/11/11 03:29:24 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -251,7 +251,9 @@ res_nopt(res_state statp,
*cp++ = 0; /*%< "." */
ns_put16(ns_t_opt, cp); /*%< TYPE */
cp += INT16SZ;
- ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */
+ if (anslen > 0xffff)
+ anslen = 0xffff;
+ ns_put16(anslen, cp); /*%< CLASS = UDP payload size */
cp += INT16SZ;
*cp++ = NOERROR; /*%< extended RCODE */
*cp++ = 0; /*%< EDNS version */