Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Mar 2018 21:57:44 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r331594 - head/cddl/contrib/opensolaris/lib/libctf/common
Message-ID:  <201803262157.w2QLvinQ062794@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Mon Mar 26 21:57:44 2018
New Revision: 331594
URL: https://svnweb.freebsd.org/changeset/base/331594

Log:
  libctf: Appease Coverity overrun warnings
  
  Rather than zeroing and reading into the a smaller union member the full
  union size, just zero and read directly into the union.
  
  No functional change intended.
  
  Reported by:	Coverity
  Sponsored by:	Dell EMC Isilon

Modified:
  head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c

Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c	Mon Mar 26 21:14:20 2018	(r331593)
+++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c	Mon Mar 26 21:57:44 2018	(r331594)
@@ -230,12 +230,12 @@ ctf_fdopen(int fd, int *errp)
 	bzero(&ctfsect, sizeof (ctf_sect_t));
 	bzero(&symsect, sizeof (ctf_sect_t));
 	bzero(&strsect, sizeof (ctf_sect_t));
-	bzero(&hdr.ctf, sizeof (hdr));
+	bzero(&hdr, sizeof (hdr));
 
 	if (fstat64(fd, &st) == -1)
 		return (ctf_set_open_errno(errp, errno));
 
-	if ((nbytes = pread64(fd, &hdr.ctf, sizeof (hdr), 0)) <= 0)
+	if ((nbytes = pread64(fd, &hdr, sizeof (hdr), 0)) <= 0)
 		return (ctf_set_open_errno(errp, nbytes < 0? errno : ECTF_FMT));
 
 	/*



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