]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/glibc/glibc-rh804686.patch
glibc: Update patchset.
[people/teissler/ipfire-2.x.git] / src / patches / glibc / glibc-rh804686.patch
1 --- a/resolv/res_query.c 2010-05-04 05:27:23.000000000 -0600
2 +++ a/resolv/res_query.c 2012-08-03 13:43:10.761506047 -0600
3 @@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp,
4 int *resplen2)
5 {
6 HEADER *hp = (HEADER *) answer;
7 + HEADER *hp2;
8 int n, use_malloc = 0;
9 u_int oflags = statp->_flags;
10
11 @@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp,
12 /* __libc_res_nsend might have reallocated the buffer. */
13 hp = (HEADER *) *answerp;
14
15 - /* We simplify the following tests by assigning HP to HP2. It
16 - is easy to verify that this is the same as ignoring all
17 - tests of HP2. */
18 - HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
19 -
20 - if (n < (int) sizeof (HEADER) && answerp2 != NULL
21 - && *resplen2 > (int) sizeof (HEADER))
22 + /* We simplify the following tests by assigning HP to HP2 or
23 + vice versa. It is easy to verify that this is the same as
24 + ignoring all tests of HP or HP2. */
25 + if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
26 {
27 - /* Special case of partial answer. */
28 - assert (hp != hp2);
29 - hp = hp2;
30 + hp2 = hp;
31 }
32 - else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
33 - && n > (int) sizeof (HEADER))
34 + else
35 {
36 - /* Special case of partial answer. */
37 - assert (hp != hp2);
38 - hp2 = hp;
39 + hp2 = (HEADER *) *answerp2;
40 + if (n < (int) sizeof (HEADER))
41 + {
42 + hp = hp2;
43 + }
44 }
45
46 + /* Make sure both hp and hp2 are defined */
47 + assert((hp != NULL) && (hp2 != NULL));
48 +
49 if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
50 && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
51 #ifdef DEBUG
52 --- a/resolv/res_send.c 2012-08-03 13:31:26.622168278 -0600
53 +++ a/resolv/res_send.c 2012-08-03 13:43:11.881501862 -0600
54 @@ -549,7 +549,7 @@ __libc_res_nsend(res_state statp, const
55 ns, ansp, ansp2, nansp2, resplen2);
56 if (n < 0)
57 return (-1);
58 - if (n == 0)
59 + if (n == 0 && (buf2 == NULL || *resplen2 == 0))
60 goto next_ns;
61 } else {
62 /* Use datagrams. */
63 @@ -559,7 +559,7 @@ __libc_res_nsend(res_state statp, const
64 ansp2, nansp2, resplen2);
65 if (n < 0)
66 return (-1);
67 - if (n == 0)
68 + if (n == 0 && (buf2 == NULL || *resplen2 == 0))
69 goto next_ns;
70 if (v_circuit)
71 // XXX Check whether both requests failed or
72 @@ -1275,10 +1275,14 @@ send_dg(res_state statp,
73 (*thisresplenp > *thisanssizp)
74 ? *thisanssizp : *thisresplenp);
75
76 - if (recvresp1 || (buf2 != NULL && recvresp2))
77 + if (recvresp1 || (buf2 != NULL && recvresp2)) {
78 + *resplen2 = 0;
79 return resplen;
80 + }
81 if (buf2 != NULL)
82 {
83 + /* No data from the first reply. */
84 + resplen = 0;
85 /* We are waiting for a possible second reply. */
86 if (hp->id == anhp->id)
87 recvresp1 = 1;