summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-05-16 01:38:24 +0000
committertruckman <truckman@FreeBSD.org>2016-05-16 01:38:24 +0000
commit98bc5f3a9802132ebb93aa04aad1e4e972882c02 (patch)
tree7d953100a42ef7dacdd7ac989b8af1e766c10f29 /lib
parentc15c547aaa47e9f324d008325a7345049bc13fb2 (diff)
downloadFreeBSD-src-98bc5f3a9802132ebb93aa04aad1e4e972882c02.zip
FreeBSD-src-98bc5f3a9802132ebb93aa04aad1e4e972882c02.tar.gz
Since rdata is only used as an argument to the immediately following
call to res_nopt_rdata(), revert r299879 and fix CID 603941 by moving rdata = &buf[n]; inside the if block. Reported by: Coverity CID: 603941
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/resolv/res_query.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/resolv/res_query.c b/lib/libc/resolv/res_query.c
index 9731638..c3c6313 100644
--- a/lib/libc/resolv/res_query.c
+++ b/lib/libc/resolv/res_query.c
@@ -135,12 +135,10 @@ again:
if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 &&
(statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) {
n = res_nopt(statp, n, buf, sizeof(buf), anslen);
- if (n > 0) {
+ if (n > 0 && (statp->options & RES_NSID) != 0U) {
rdata = &buf[n];
- if ((statp->options & RES_NSID) != 0U) {
- n = res_nopt_rdata(statp, n, buf, sizeof(buf),
- rdata, NS_OPT_NSID, 0, NULL);
- }
+ n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata,
+ NS_OPT_NSID, 0, NULL);
}
}
#endif
OpenPOWER on IntegriCloud