aboutsummaryrefslogtreecommitdiff
path: root/resolv/res_query.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-07-08 16:40:24 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-07-08 22:52:49 +0530
commite35c53e397e7abbd41fedacdedcfa5af7b5c2c52 (patch)
treea2ad8eb75106c36132545800df7128b841324926 /resolv/res_query.c
parent80b5c505889ac4747aab54614d2bce18efa511ea (diff)
downloadglibc-e35c53e397e7abbd41fedacdedcfa5af7b5c2c52.tar
glibc-e35c53e397e7abbd41fedacdedcfa5af7b5c2c52.tar.gz
glibc-e35c53e397e7abbd41fedacdedcfa5af7b5c2c52.tar.bz2
glibc-e35c53e397e7abbd41fedacdedcfa5af7b5c2c52.zip
Check value at resplen2 if it is not NULL
There was a typo in the previous patch due to which resplen2 was checked for non-zero instead of the value at resplen2. Fix that and improve the condition by checking resplen2 for non-NULL (instead of answerp2) and also adding the check in a third place.
Diffstat (limited to 'resolv/res_query.c')
-rw-r--r--resolv/res_query.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 4e6612c283..e4ee2a6005 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -384,7 +384,7 @@ __libc_res_nsearch(res_state statp,
answerp2_malloced);
if (ret > 0 || trailing_dot
/* If the second response is valid then we use that. */
- || (ret == 0 && answerp2 != NULL && resplen2 > 0))
+ || (ret == 0 && resplen2 != NULL && *resplen2 > 0))
return (ret);
saved_herrno = h_errno;
tried_as_is++;
@@ -424,8 +424,8 @@ __libc_res_nsearch(res_state statp,
answer, anslen, answerp,
answerp2, nanswerp2,
resplen2, answerp2_malloced);
- if (ret > 0 || (ret == 0 && answerp2 != NULL
- && resplen2 > 0))
+ if (ret > 0 || (ret == 0 && resplen2 != NULL
+ && *resplen2 > 0))
return (ret);
if (answerp && *answerp != answer) {
@@ -494,7 +494,8 @@ __libc_res_nsearch(res_state statp,
answer, anslen, answerp,
answerp2, nanswerp2, resplen2,
answerp2_malloced);
- if (ret > 0)
+ if (ret > 0 || (ret == 0 && resplen2 != NULL
+ && *resplen2 > 0))
return (ret);
}