Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2016 01:38:25 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299880 - head/lib/libc/resolv
Message-ID:  <201605160138.u4G1cPTs069809@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Mon May 16 01:38:24 2016
New Revision: 299880
URL: https://svnweb.freebsd.org/changeset/base/299880

Log:
  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

Modified:
  head/lib/libc/resolv/res_query.c

Modified: head/lib/libc/resolv/res_query.c
==============================================================================
--- head/lib/libc/resolv/res_query.c	Mon May 16 01:30:32 2016	(r299879)
+++ head/lib/libc/resolv/res_query.c	Mon May 16 01:38:24 2016	(r299880)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605160138.u4G1cPTs069809>