From d697348566c3d435aada7702f1e7f72a1acd241a Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Mon, 22 Oct 2012 13:39:22 +0200 Subject: [PATCH] glibc: add patch for fixing a problem with name resolution with errors from some name servers Note: http://www.linuxfromscratch.org/patches/lfs/development/glibc-2.16.0-res_query_fix-1.patch --- base/glibc/glibc-2.16.0-res_query_fix-1.patch | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 base/glibc/glibc-2.16.0-res_query_fix-1.patch diff --git a/base/glibc/glibc-2.16.0-res_query_fix-1.patch b/base/glibc/glibc-2.16.0-res_query_fix-1.patch new file mode 100644 index 000000000..f3885b6de --- /dev/null +++ b/base/glibc/glibc-2.16.0-res_query_fix-1.patch @@ -0,0 +1,75 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../glibc/glibc-2.16.0-res_query_fix-1.patch +# Copyright (C) 2012 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +Submitted By: Bruce Dubbs +Date: 2012-08-27 +Initial Package Version: 2.16.0 +Upstream Status: Not yet applied, but in other distros. +Origin: http://sourceware.org/bugzilla/attachment.cgi?id=5855 +Description: Fixes a problem with name resolution with errors + from some name servers. + +--- a/resolv/res_query.c ++++ a/resolv/res_query.c +@@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp, + int *resplen2) + { + HEADER *hp = (HEADER *) answer; ++ HEADER *hp2; + int n, use_malloc = 0; + u_int oflags = statp->_flags; + +@@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp, + /* __libc_res_nsend might have reallocated the buffer. */ + hp = (HEADER *) *answerp; + +- /* We simplify the following tests by assigning HP to HP2. It +- is easy to verify that this is the same as ignoring all +- tests of HP2. */ +- HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp; +- +- if (n < (int) sizeof (HEADER) && answerp2 != NULL +- && *resplen2 > (int) sizeof (HEADER)) ++ /* We simplify the following tests by assigning HP to HP2 or ++ vice versa. It is easy to verify that this is the same as ++ ignoring all tests of HP or HP2. */ ++ if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER)) + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp = hp2; ++ hp2 = hp; + } +- else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER) +- && n > (int) sizeof (HEADER)) ++ else + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp2 = hp; ++ hp2 = (HEADER *) *answerp2; ++ if (n < (int) sizeof (HEADER)) ++ { ++ hp = hp2; ++ } + } + ++ /* Make sure both hp and hp2 are defined */ ++ assert((hp != NULL) && (hp2 != NULL)); ++ + if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0) + && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) { + #ifdef DEBUG