summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-05-20 07:18:33 +0000
committertruckman <truckman@FreeBSD.org>2016-05-20 07:18:33 +0000
commit3e7c4636cf83666cd3ab3b82895524105920a1d3 (patch)
treecb04a2d6ace178de8da90f89d1df4afdcd6fa90a /lib
parentf13286bea2a5de0abb600bc6528987f21cf48a28 (diff)
downloadFreeBSD-src-3e7c4636cf83666cd3ab3b82895524105920a1d3.zip
FreeBSD-src-3e7c4636cf83666cd3ab3b82895524105920a1d3.tar.gz
MFC r299879, r299880
r299879 | truckman | 2016-05-15 18:30:32 -0700 (Sun, 15 May 2016) | 7 lines Likely a false positive ... but make sure that -1 can't be used as an array index by splitting up a test. r299880 | truckman | 2016-05-15 18:38:24 -0700 (Sun, 15 May 2016) | 8 lines 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/resolv/res_query.c b/lib/libc/resolv/res_query.c
index 5992edd..a6df3f2 100644
--- a/lib/libc/resolv/res_query.c
+++ b/lib/libc/resolv/res_query.c
@@ -136,8 +136,8 @@ 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);
- rdata = &buf[n];
if (n > 0 && (statp->options & RES_NSID) != 0U) {
+ rdata = &buf[n];
n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata,
NS_OPT_NSID, 0, NULL);
}
OpenPOWER on IntegriCloud