Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/lib/libc/resolv Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/06fea4d168d1
branches:  netbsd-6
changeset: 776794:06fea4d168d1
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Dec 02 21:56:37 2014 +0000

description:
Pull up following revision(s) (requested by pettai in ticket #1191):
        lib/libc/resolv/res_mkquery.c: revision 1.14
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.

diffstat:

 lib/libc/resolv/res_mkquery.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 90f05ff60075 -r 06fea4d168d1 lib/libc/resolv/res_mkquery.c
--- a/lib/libc/resolv/res_mkquery.c     Mon Nov 10 02:38:12 2014 +0000
+++ b/lib/libc/resolv/res_mkquery.c     Tue Dec 02 21:56:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_mkquery.c,v 1.12 2009/04/12 19:43:37 christos Exp $        */
+/*     $NetBSD: res_mkquery.c,v 1.12.8.1 2014/12/02 21:56:37 snj 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.12 2009/04/12 19:43:37 christos Exp $");
+__RCSID("$NetBSD: res_mkquery.c,v 1.12.8.1 2014/12/02 21:56:37 snj Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -249,7 +249,9 @@
        *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 */



Home | Main Index | Thread Index | Old Index