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
This commit is contained in:
Don Lewis 2016-05-16 01:38:24 +00:00
parent 0abffcb5f8
commit 0ee6da55a6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299880

View File

@ -135,12 +135,10 @@ res_nquery(res_state statp,
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