Ticket #3172: glibc-test.patch
File glibc-test.patch, 1.6 KB (added by , 12 years ago) |
---|
-
resolv/res_query.c
old new 122 122 int *resplen2) 123 123 { 124 124 HEADER *hp = (HEADER *) answer; 125 HEADER *hp2; 125 126 int n, use_malloc = 0; 126 127 u_int oflags = statp->_flags; 127 128 … … 239 240 /* __libc_res_nsend might have reallocated the buffer. */ 240 241 hp = (HEADER *) *answerp; 241 242 242 /* We simplify the following tests by assigning HP to HP2. It 243 is easy to verify that this is the same as ignoring all 244 tests of HP2. */ 245 HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp; 246 247 if (n < (int) sizeof (HEADER) && answerp2 != NULL 248 && *resplen2 > (int) sizeof (HEADER)) 243 /* We simplify the following tests by assigning HP to HP2 or 244 vice versa. It is easy to verify that this is the same as 245 ignoring all tests of HP or HP2. */ 246 if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER)) 249 247 { 250 248 /* Special case of partial answer. */ 251 249 assert (hp != hp2); 252 250 hp = hp2; 251 hp2 = hp; 253 252 } 254 else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER) 255 && n > (int) sizeof (HEADER)) 253 else 256 254 { 257 255 /* Special case of partial answer. */ 258 assert (hp != hp2);259 256 hp2 = hp; 257 hp2 = (HEADER *) *answerp2; 258 if (n < (int) sizeof (HEADER)) 259 { 260 hp = hp2; 261 } 260 262 } 261 263 264 /* Make sure both hp and hp2 are defined */ 265 assert((hp != NULL) && (hp2 != NULL)); 266 262 267 if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0) 263 268 && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) { 264 269 #ifdef DEBUG