Rediff patch

This commit is contained in:
Denis Silakov 2016-02-19 17:05:09 +03:00
parent 1b06f41956
commit 7b58e91d6f

View file

@ -1,8 +1,7 @@
Index: b/resolv/nss_dns/dns-host.c diff -Naur glibc-2.15-a316c1f.orig/resolv/nss_dns/dns-host.c glibc-2.15-a316c1f/resolv/nss_dns/dns-host.c
=================================================================== --- glibc-2.15-a316c1f.orig/resolv/nss_dns/dns-host.c 2016-02-19 16:09:38.070805200 +0300
--- a/resolv/nss_dns/dns-host.c +++ glibc-2.15-a316c1f/resolv/nss_dns/dns-host.c 2016-02-19 16:09:38.072805201 +0300
+++ b/resolv/nss_dns/dns-host.c @@ -1030,7 +1030,10 @@
@@ -1051,7 +1051,10 @@ gaih_getanswer_slice (const querybuf *an
int h_namelen = 0; int h_namelen = 0;
if (ancount == 0) if (ancount == 0)
@ -14,7 +13,7 @@ Index: b/resolv/nss_dns/dns-host.c
while (ancount-- > 0 && cp < end_of_message && had_error == 0) while (ancount-- > 0 && cp < end_of_message && had_error == 0)
{ {
@@ -1228,7 +1231,14 @@ gaih_getanswer_slice (const querybuf *an @@ -1199,7 +1202,14 @@
/* Special case here: if the resolver sent a result but it only /* Special case here: if the resolver sent a result but it only
contains a CNAME while we are looking for a T_A or T_AAAA record, contains a CNAME while we are looking for a T_A or T_AAAA record,
we fail with NOTFOUND instead of TRYAGAIN. */ we fail with NOTFOUND instead of TRYAGAIN. */
@ -30,7 +29,7 @@ Index: b/resolv/nss_dns/dns-host.c
} }
@@ -1242,11 +1252,101 @@ gaih_getanswer (const querybuf *answer1, @@ -1213,11 +1223,101 @@
enum nss_status status = NSS_STATUS_NOTFOUND; enum nss_status status = NSS_STATUS_NOTFOUND;
@ -131,8 +130,8 @@ Index: b/resolv/nss_dns/dns-host.c
+ +
if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
|| (status == NSS_STATUS_TRYAGAIN || (status == NSS_STATUS_TRYAGAIN
/* We want to look at the second answer in case of an && (errno != ERANGE || *h_errnop != NO_RECOVERY)))
@@ -1262,8 +1362,15 @@ gaih_getanswer (const querybuf *answer1, @@ -1227,8 +1327,15 @@
&pat, &buffer, &buflen, &pat, &buffer, &buflen,
errnop, h_errnop, ttlp, errnop, h_errnop, ttlp,
&first); &first);
@ -148,38 +147,36 @@ Index: b/resolv/nss_dns/dns-host.c
} }
return status; return status;
Index: b/resolv/res_query.c diff -Naur glibc-2.15-a316c1f.orig/resolv/res_query.c glibc-2.15-a316c1f/resolv/res_query.c
=================================================================== --- glibc-2.15-a316c1f.orig/resolv/res_query.c 2016-02-19 16:09:38.070805200 +0300
--- a/resolv/res_query.c +++ glibc-2.15-a316c1f/resolv/res_query.c 2016-02-19 16:10:13.893807618 +0300
+++ b/resolv/res_query.c @@ -391,6 +391,7 @@
@@ -396,6 +396,7 @@ __libc_res_nsearch(res_state statp,
{ {
free (*answerp2); free (*answerp2);
*answerp2 = NULL; *answerp2 = NULL;
+ *nanswerp2 = 0; + *nanswerp2 = 0;
*answerp2_malloced = 0;
} }
} }
@@ -436,6 +437,7 @@ __libc_res_nsearch(res_state statp,
{
free (*answerp2);
*answerp2 = NULL;
+ *nanswerp2 = 0;
*answerp2_malloced = 0;
}
@@ -510,6 +512,7 @@ __libc_res_nsearch(res_state statp, @@ -431,6 +432,7 @@
{
free (*answerp2);
*answerp2 = NULL;
+ *nanswerp2 = 0;
}
/*
@@ -502,6 +504,7 @@
{ {
free (*answerp2); free (*answerp2);
*answerp2 = NULL; *answerp2 = NULL;
+ *nanswerp2 = 0; + *nanswerp2 = 0;
*answerp2_malloced = 0;
} }
if (saved_herrno != -1) if (saved_herrno != -1)
Index: b/resolv/res_send.c RES_SET_H_ERRNO(statp, saved_herrno);
=================================================================== diff -Naur glibc-2.15-a316c1f.orig/resolv/res_send.c glibc-2.15-a316c1f/resolv/res_send.c
--- a/resolv/res_send.c --- glibc-2.15-a316c1f.orig/resolv/res_send.c 2016-02-19 16:09:38.069805200 +0300
+++ b/resolv/res_send.c +++ glibc-2.15-a316c1f/resolv/res_send.c 2016-02-19 16:12:07.213815266 +0300
@@ -1,3 +1,20 @@ @@ -1,3 +1,20 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc. +/* Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library. + This file is part of the GNU C Library.
@ -201,7 +198,7 @@ Index: b/resolv/res_send.c
/* /*
* Copyright (c) 1985, 1989, 1993 * Copyright (c) 1985, 1989, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@@ -360,6 +377,8 @@ __libc_res_nsend(res_state statp, const @@ -360,6 +377,8 @@
#ifdef USE_HOOKS #ifdef USE_HOOKS
if (__builtin_expect (statp->qhook || statp->rhook, 0)) { if (__builtin_expect (statp->qhook || statp->rhook, 0)) {
if (anssiz < MAXPACKET && ansp) { if (anssiz < MAXPACKET && ansp) {
@ -210,7 +207,7 @@ Index: b/resolv/res_send.c
u_char *buf = malloc (MAXPACKET); u_char *buf = malloc (MAXPACKET);
if (buf == NULL) if (buf == NULL)
return (-1); return (-1);
@@ -653,6 +672,77 @@ libresolv_hidden_def (res_nsend) @@ -652,6 +671,77 @@
/* Private */ /* Private */
@ -288,7 +285,7 @@ Index: b/resolv/res_send.c
static int static int
send_vc(res_state statp, send_vc(res_state statp,
const u_char *buf, int buflen, const u_char *buf2, int buflen2, const u_char *buf, int buflen, const u_char *buf2, int buflen2,
@@ -662,11 +752,7 @@ send_vc(res_state statp, @@ -661,11 +751,7 @@
{ {
const HEADER *hp = (HEADER *) buf; const HEADER *hp = (HEADER *) buf;
const HEADER *hp2 = (HEADER *) buf2; const HEADER *hp2 = (HEADER *) buf2;
@ -301,7 +298,7 @@ Index: b/resolv/res_send.c
struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns]; struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
int truncating, connreset, resplen, n; int truncating, connreset, resplen, n;
struct iovec iov[4]; struct iovec iov[4];
@@ -742,6 +828,8 @@ send_vc(res_state statp, @@ -741,6 +827,8 @@
* Receive length & response * Receive length & response
*/ */
int recvresp1 = 0; int recvresp1 = 0;
@ -310,7 +307,7 @@ Index: b/resolv/res_send.c
int recvresp2 = buf2 == NULL; int recvresp2 = buf2 == NULL;
uint16_t rlen16; uint16_t rlen16;
read_len: read_len:
@@ -778,33 +866,14 @@ send_vc(res_state statp, @@ -777,33 +865,14 @@
u_char **thisansp; u_char **thisansp;
int *thisresplenp; int *thisresplenp;
if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) { if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
@ -347,7 +344,7 @@ Index: b/resolv/res_send.c
thisanssizp = anssizp2; thisanssizp = anssizp2;
thisansp = ansp2; thisansp = ansp2;
thisresplenp = resplen2; thisresplenp = resplen2;
@@ -812,10 +881,14 @@ send_vc(res_state statp, @@ -811,10 +880,14 @@
anhp = (HEADER *) *thisansp; anhp = (HEADER *) *thisansp;
*thisresplenp = rlen; *thisresplenp = rlen;
@ -366,9 +363,9 @@ Index: b/resolv/res_send.c
u_char *newp = malloc (MAXPACKET); u_char *newp = malloc (MAXPACKET);
if (newp == NULL) { if (newp == NULL) {
*terrno = ENOMEM; *terrno = ENOMEM;
@@ -827,6 +900,9 @@ send_vc(res_state statp, @@ -824,6 +897,9 @@
if (thisansp == ansp2) *thisanssizp = MAXPACKET;
*ansp2_malloced = 1; *thisansp = newp;
anhp = (HEADER *) newp; anhp = (HEADER *) newp;
+ /* A uint16_t can't be larger than MAXPACKET + /* A uint16_t can't be larger than MAXPACKET
+ thus it's safe to allocate MAXPACKET but + thus it's safe to allocate MAXPACKET but
@ -376,7 +373,7 @@ Index: b/resolv/res_send.c
len = rlen; len = rlen;
} else { } else {
Dprint(statp->options & RES_DEBUG, Dprint(statp->options & RES_DEBUG,
@@ -990,6 +1066,66 @@ reopen (res_state statp, int *terrno, in @@ -987,6 +1063,66 @@
return 1; return 1;
} }
@ -443,7 +440,7 @@ Index: b/resolv/res_send.c
static int static int
send_dg(res_state statp, send_dg(res_state statp,
const u_char *buf, int buflen, const u_char *buf2, int buflen2, const u_char *buf, int buflen, const u_char *buf2, int buflen2,
@@ -999,8 +1135,6 @@ send_dg(res_state statp, @@ -996,8 +1132,6 @@
{ {
const HEADER *hp = (HEADER *) buf; const HEADER *hp = (HEADER *) buf;
const HEADER *hp2 = (HEADER *) buf2; const HEADER *hp2 = (HEADER *) buf2;
@ -452,7 +449,7 @@ Index: b/resolv/res_send.c
struct timespec now, timeout, finish; struct timespec now, timeout, finish;
struct pollfd pfd[1]; struct pollfd pfd[1];
int ptimeout; int ptimeout;
@@ -1033,6 +1167,8 @@ send_dg(res_state statp, @@ -1029,6 +1163,8 @@
int need_recompute = 0; int need_recompute = 0;
int nwritten = 0; int nwritten = 0;
int recvresp1 = 0; int recvresp1 = 0;
@ -461,7 +458,7 @@ Index: b/resolv/res_send.c
int recvresp2 = buf2 == NULL; int recvresp2 = buf2 == NULL;
pfd[0].fd = EXT(statp).nssocks[ns]; pfd[0].fd = EXT(statp).nssocks[ns];
pfd[0].events = POLLOUT; pfd[0].events = POLLOUT;
@@ -1196,52 +1332,54 @@ send_dg(res_state statp, @@ -1125,50 +1261,52 @@
int *thisresplenp; int *thisresplenp;
if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) { if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
@ -521,8 +518,6 @@ Index: b/resolv/res_send.c
- *thisansp = ans = newp; - *thisansp = ans = newp;
+ *thisanssizp = MAXPACKET; + *thisanssizp = MAXPACKET;
+ *thisansp = newp; + *thisansp = newp;
if (thisansp == ansp2)
*ansp2_malloced = 1;
} }
} }
+ /* We could end up with truncation if anscp was NULL + /* We could end up with truncation if anscp was NULL