Fix Coverity bug 603941: Negative array index read

Signed-off-by: Philippe Saint-Pierre <[email protected]>
This commit is contained in:
Puck Meerburg
2014-07-15 15:14:56 -04:00
committed by Philippe Saint-Pierre
parent 37b6c4337c
commit d32cb23734
+1 -1
View File
@@ -135,8 +135,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);
}