Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/resolv PR/48475: YAMAGUCHI Takanori: EDNS option br...



details:   https://anonhg.NetBSD.org/src/rev/b30e5cd52e9c
branches:  trunk
changeset: 803759:b30e5cd52e9c
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 11 03:29:24 2014 +0000

description:
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.

diffstat:

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

diffs (29 lines):

diff -r de2f335bc9af -r b30e5cd52e9c lib/libc/resolv/res_mkquery.c
--- a/lib/libc/resolv/res_mkquery.c     Tue Nov 11 02:49:16 2014 +0000
+++ b/lib/libc/resolv/res_mkquery.c     Tue Nov 11 03:29:24 2014 +0000
@@ -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 @@
        *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