Magellan Linux

Annotation of /trunk/glibc/patches/glibc-2.15-fix-res_query-assert.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1806 - (hide annotations) (download)
Tue Jun 12 12:33:27 2012 UTC (11 years, 11 months ago) by niro
File size: 1560 byte(s)
-added patches for 2.15-r1
1 niro 1806 --- a/resolv/res_query.c
2     +++ a/resolv/res_query.c
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