]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-bug-12684.patch
- fix getaddrinfo memory leak
[packages/glibc.git] / glibc-bug-12684.patch
1 commit 4769ae77fc6c8dacea6476addb015c8797848cdd
2 Author: Ulrich Drepper <drepper@gmail.com>
3 Date:   Mon May 30 22:48:47 2011 -0400
4
5     Handle DNS server failures in case of AF_UNSPEC lookups correctly
6
7 diff --git a/ChangeLog b/ChangeLog
8 index 31719ab..dd4ad9e 100644
9 --- a/ChangeLog
10 +++ b/ChangeLog
11 @@ -1,5 +1,10 @@
12  2011-05-30  Ulrich Drepper  <drepper@gmail.com>
13  
14 +       [BZ #12684]
15 +       * resolv/res_send.c (__libc_res_nsend): Only go to the next name server
16 +       if both request failed.
17 +       (send_dg): In case of server errors clear resplen or *resplen2.
18 +
19         [BZ #12454]
20         * elf/dl-deps.c (_dl_map_object_deps): Run initializer sorting only
21         when there are multiple maps.
22 diff --git a/resolv/res_send.c b/resolv/res_send.c
23 index 845b658..97142b7 100644
24 --- a/resolv/res_send.c
25 +++ b/resolv/res_send.c
26 @@ -549,7 +549,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
27                                     ns, ansp, ansp2, nansp2, resplen2);
28                         if (n < 0)
29                                 return (-1);
30 -                       if (n == 0)
31 +                       if (n == 0 && (buf2 == NULL || resplen2 == 0))
32                                 goto next_ns;
33                 } else {
34                         /* Use datagrams. */
35 @@ -559,7 +559,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
36                                     ansp2, nansp2, resplen2);
37                         if (n < 0)
38                                 return (-1);
39 -                       if (n == 0)
40 +                       if (n == 0 && (buf2 == NULL || resplen2 == 0))
41                                 goto next_ns;
42                         if (v_circuit)
43                           // XXX Check whether both requests failed or
44 @@ -1275,10 +1275,14 @@ send_dg(res_state statp,
45                                 (*thisresplenp > *thisanssizp)
46                                 ? *thisanssizp : *thisresplenp);
47  
48 -                       if (recvresp1 || (buf2 != NULL && recvresp2))
49 +                       if (recvresp1 || (buf2 != NULL && recvresp2)) {
50 +                         *resplen2 = 0;
51                           return resplen;
52 +                       }
53                         if (buf2 != NULL)
54                           {
55 +                           /* No data from the first reply.  */
56 +                           resplen = 0;
57                             /* We are waiting for a possible second reply.  */
58                             if (hp->id == anhp->id)
59                               recvresp1 = 1;
60 @@ -1344,7 +1348,7 @@ send_dg(res_state statp,
61                 goto err_out;
62         }
63         else {
64 -               /* poll should not have returned > 0 in this case.  */
65 +               /* poll should not have returned > 0 in this case.  */
66                 abort ();
67         }
68  }
This page took 0.036373 seconds and 3 git commands to generate.