1 commit e35c53e397e7abbd41fedacdedcfa5af7b5c2c52
2 Author: Siddhesh Poyarekar <siddhesh@redhat.com>
3 Date: Tue Jul 8 16:40:24 2014 +0530
5 Check value at resplen2 if it is not NULL
7 There was a typo in the previous patch due to which resplen2 was
8 checked for non-zero instead of the value at resplen2. Fix that and
9 improve the condition by checking resplen2 for non-NULL (instead of
10 answerp2) and also adding the check in a third place.
12 diff --git a/resolv/res_query.c b/resolv/res_query.c
13 index 4e6612c..e4ee2a6 100644
14 --- a/resolv/res_query.c
15 +++ b/resolv/res_query.c
16 @@ -384,7 +384,7 @@ __libc_res_nsearch(res_state statp,
17 answerp2, nanswerp2, resplen2);
18 if (ret > 0 || trailing_dot
19 /* If the second response is valid then we use that. */
20 - || (ret == 0 && answerp2 != NULL && resplen2 > 0))
21 + || (ret == 0 && resplen2 != NULL && *resplen2 > 0))
23 saved_herrno = h_errno;
25 @@ -424,8 +424,8 @@ __libc_res_nsearch(res_state statp,
26 answer, anslen, answerp,
29 - if (ret > 0 || (ret == 0 && answerp2 != NULL
31 + if (ret > 0 || (ret == 0 && resplen2 != NULL
35 if (answerp && *answerp != answer) {
36 @@ -494,7 +494,8 @@ __libc_res_nsearch(res_state statp,
37 ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
38 answer, anslen, answerp,
39 answerp2, nanswerp2, resplen2);
41 + if (ret > 0 || (ret == 0 && resplen2 != NULL